I have a form that on load show login form on webbrowser. When user login and then exit without loging out, it automatically logging him out on next start up and showing him again the login form. To logout from site 2 navigations needed but I don’t user to see that navigations, I want the browser to be white until all navigations complete or something similar.
bool f = true;
private void Form1_Load(object sender, EventArgs e)
{
wbLoad.Navigate("http://login.uid.me/?site=dmysite&ref=http://mysite.ucoz.com/");
}
private void wbLoad_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (f == true)
{
if (wbLoad.DocumentText.Contains("Sign up"))
{
wbLoad.Navigate("http://login.uid.me/?site=dmysite&ref=http://mysite.ucoz.com/");
f = false;
}
else if (wbLoad.DocumentText.Contains("Log out"))
{
wbLoad.Navigate("http://mysite.ucoz.com/index/10");
f = true;
}
else
{
wbLoad.Navigate("http://uid.me/logout/?mode=1&noajax=1");
f = true;
}
}
}
Logging out means in most cases just removing cookies for current host. If it’s your case, you can do it by using javascript. Note, that this JS will remove cookies only for current host. You can call it in
FormClosingevent