views:

84

answers:

1

A few more details.

I need to programmatically (Winforms, VB.NET) check if a site is in the Allowed Sites list of the IE Pop-Up Blocker (IE 7 and 8 and Windows XP, Vista and 7) and if not, add it. The application is fully trusted and I don't want to disable the Pop-Up blocker entirely.

To clarify some things, this is for a web-automation application with several users across 3 countries. I want to avoid receiving tons of emails and explaining each time how to add the website to the Allowed Sites manually.

Also, some of the users have Google Toolbar installed, which also has a Popup Blocker creating trouble to my app. Can this also be done programmatically?

A: 

Ok, I got the first part. It's just a registry value.

Imports Microsoft.Win32

And the actual code:

Dim siteString As String = "mysite.com"
Dim emptyArray() As Byte = New Byte() {} 'Works as a Zero-Length Binary Value'
Dim subKey As String = "Software\Microsoft\Internet Explorer\New Windows\Allow"
Dim rkKey As RegistryKey = Registry.CurrentUser.OpenSubKey(subKey)

Dim value As Object = rkKey.GetValue(siteString)
If value Is Nothing Then 'Check if the value is already there'
    rkKey.SetValue(siteString, emptyArray, RegistryValueKind.Binary)
End If

It also works with multiple versions of IE and Windows.

Does anyone have any idea about the Google toolbar Popup blocker?

ps. Sorry about closing the single quotes, but it simply makes it look nicer.

GlueR