1

I need to impersonate the WinForms Webbrowser Control. For impersonating I'm using the AliasAccount class from here: Open remote shared folder with credentials

It works great but not with the WebBrowser control.

AliasAccount aa = new AliasAccount(DomainName + "\\" + UserName, mypassword);

    aa.BeginImpersonation();

    WebBrowser webImp = new WebBrowser();
    webImp.Height = 220;
    webImp.Width = 220;
    webImp.Location = new Point(390, 208);
    webImp.Navigate("http://www.google.com");

    this.Controls.Add(webImp);
    aa.EndImpersonation();

I see the control in my form but the webImp.Navigate("www.google.ch") does not work! I don't know why. Does somebody have an idea?

If I check the ReadyState of the Webbrowser:

while (wbImp.ReadyState != WebBrowserReadyState.Complete) {
    Application.DoEvents();
}

It never stops. It's keeping in the loop.

Community
  • 1
  • 1
syntax412
  • 81
  • 1
  • 9

0 Answers0