I'm trying to run a WebBrowser containing form on a new STA thread.
The code runs as expected on Windows 7, but on Windows 10 the navigation cancels automatically.
I tried to set each of the zone security settings to minimum from Internet Options but nothing changed.
Navigation to the webpage was canceled
Zone: My Computer | Protected Mode: Off res://ieframe.dll/navcancl.htm#https://google.com/
This page can’t be displayed
Zone: My Computer | Protected Mode: Off res://ieframe.dll/dnserrordiagoff.htm#https://google.com/
Any suggestions?
private void button1_Click(object sender, EventArgs e)
{
ServicePointManager.DefaultConnectionLimit = 10;
var thread = new Thread(ShowFormWebBrowser) {IsBackground = true};
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
}
public static void ShowFormWebBrowser()
{
using (var dlg = new FormWebBrowser())
{
if (dlg.ShowDialog() == DialogResult.OK)
{
}
}
}