C#操作注册表干掉安全警告【是否只查看安全传送的网页内容】

安全警告【是否只查看安全传送的网页内容】

这SB一样的对话框,是自IE8开始出现的,虽然可以通过Internet选项修改为允许,但是如果用程序修改就无从下手了

Google了下【C# Change Internet Explorer settings】,运气很好,第一个就是,通过注册表可以修改

以下是原文:

Any idea how do I do the following using C#?

  1. Going to Tools -> Internet Options -> Security
  2. Select the Security tab
  3. Click the Custom Level button
  4. In the Miscellaneous section change Display mixed content to Enable

The “cheat” way to do this is to change the value

    1. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\0\1609
    2. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1\1609
    3. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2\1609
    4. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\1609
    5. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4\1609

Where 0-4 are Zone identifiers and the value is 0 to Allow, 1 to Prompt, and 3 to Block. Keep in mind that if your code does this on anyone’s machine but your own, you’re likely to find your code blocked as malware.

The “proper” way to do this is to use the APIs to create an IInternetZoneManager and callSetZoneActionPolicy to adjust the settings for URLACTION_HTML_MIXED_CONTENT in the zones you want to adjust.

很好,看起来这个对话框可以干掉了,只需要在程序运行时修改就可以了,但是要注意,一定要在WebBrowser控件初始化前改变,否则等下次生效吧!

什么时候写完代码,再更新C#操作注册表调整Internet选项~哈哈

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据