WebBrowser Control navigate problem RRS feed

  • Question

  • Hi

    I have simple app that has 2 Forms... Form1 and Form2.

    On Form1 is Button1 that on click open Form2.

    Form2 has WebBrowser1 control and on Form_Load event the  WebBrowser navigate to web page "https://development.com/externalLogin?token=HypZ86VSf"

    First time when i open Form2 , WebBrowser load web page correctly. When i close Form2 and open it again web page is not loaded completely....and i get javascript error

    After i restart app and open From2 webpage is loaded normaly....

    I tryed folowing metods : 

    InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0)


    WebBrowser2.Document.ExecCommand("ClearAuthenticationCache", False, Nothing)

    WebBrowser2.Navigate("javascript:void((function(){var a,b,c,e,f;f=0;a=document.cookie.split('; ');for(e=0;e<a.length&&a[e];e++){f++;for(b='.'+location.host;b;b=b.replace(/^(?:%5C.|[^%5C.]+)/,'')){for(c=location.pathname;c;c=c.replace(/.$/,'')){document.cookie=(a[e]+'; domain='+b+'; path='+c+'; expires='+new Date((new Date()).getTime()-1e11).toGMTString());}}}})())")

    also i tryed manualy dispose webBowser control on form_Closed event....

    any solution ?

    Tuesday, January 23, 2018 3:10 PM