We have a WebBrowser that needs to have login information reset.
There is a solution in this question that suggests using INTERNET_HANDLE_TYPE_INTERNET
with INTERNET_OPTION_END_BROWSER_SESSION
. However, I'm not sure where INTERNET_HANDLE_TYPE_INTERNET
should go.
private const int INTERNET_OPTION_END_BROWSER_SESSION = 42;
private const int INTERNET_HANDLE_TYPE_INTERNET = 1;
[DllImport("wininet.dll", SetLastError = true)]
private static extern bool InternetSetOption(IntPtr hInternet, int dwOption,
IntPtr lpBuffer, int lpdwBufferLength);
I call it right before I navigate:
InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero,
0);
browserCtrl.WebBrowser.Navigate(loginUrl);