leathu raj

leathu raj

  • NA
  • 62
  • 78k

How to auto login using webbrowser in c#

Jul 28 2014 6:48 AM
 Hi...
   hai i am doing one project using webbrowser contol. In that i want to  auto login to html page programatically giving password and auto login to my website link.
 My problem is in  login page the username is in combobox and it have an default username i dont want to change it. And also i give password from my codings. It works fine. after i give codings for click login button. When I run my program the username combobox left empty it does not login to nextpage my html program coding as below...
  <select id="SELECT_UserName"><option> </option>
 <input type="password" id="Psd" value="" onKeyDown='if(event.keyCode==13)uipostLogin()' />
 <input type="button" name="logint" id="login" value="Login" onClick="Login()"/>
 
and my form codings as below
 
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlDocument d = this.webBrowser1.Document;
d.GetElementById("Psd").SetAttribute("value", "xxxxxx");
d.GetElementById("login").InvokeMember("click");
}
Plase help me.... How i do auto login....
Thanks in advance.....