首页 文章

WPF WebBrowser控件警告“Intranet设置”

提问于
浏览
3

我正在使用WebBrowser控件构建WPF应用程序 . 该应用程序在localhost端口上运行一个迷你Web服务器(通过HttpListener),WebBrowser指向它 .

当应用程序在Windows7 / IE9上启动时,WebBrowser顶部会出现安全警告:“默认情况下,Intranet安全设置已关闭.Internet网络设置不如Internet设置安全 . 点击选项...”

我希望我的应用程序不显示该消息 . 我能这样做吗?如果是这样,怎么样?

1 回答

  • 4

    感谢safetyOtter,我刚刚添加了此代码来解决问题:

    string key = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\localhost";
    RegistryKey localhost = Registry.CurrentUser.CreateSubKey(key);
    localhost.SetValue("http", 1);
    

相关问题