Programmatically add trusted sites to Internet Explorer

Even Mien picture Even Mien · Jun 9, 2009 · Viewed 34.2k times · Source

I'm doing an IE automation project using WatiN.

When a file to be downloaded is clicked, I get the following in the Internet Explorer Information bar:

To help protect your security, Internet Explorer has blocked this site from downloading files to you computer.

In order to download the report, I can manually add the site to Internet Explorer's list of trusted sites, but I would prefer to check programmatically in .NET to see if the site is trusted and add it to the list if it is not.

FYI, I'm currently using IE7.

Answer

Ben Schwehn picture Ben Schwehn · Jun 9, 2009

Have a look at this

Basically it looks as if all you have to do is create registry key in

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\DOMAINNAME

then a REG_DWORD value named "http" with value==2