المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : log into a website



C# Programming
04-08-2012, 02:41 AM
I put together a simple web browser using c#. Its great, its simple. I
added a button. I click the button and I want to be able to log into a
particular website. I have this code:

string username = "username";string password = "pass";string commit = "Login";string postData = string.Format("txtuserid={0}&txtpassword={1}&btnlogin={2}", username, password, commit); ASCIIEncoding enc = new ASCIIEncoding(); webBrowser1.Navigate("new page.html", "", enc.GetBytes(postData), "Content-Type: application/x-www-form-urlencoded\r\n");
But it doesnt do anything. Is there a way to make the username and password
appear in there respective boxes? Is there another command that I use to
make it click that Login button and move onto the next page?

Please any response any one can give me will be greatly appreciated.