Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to programatically login to a website with C#?

Tags:

c#

web-crawler

Is it possible to write a C# program that will load up a webpage, pass the webform parameters to login, then click on a link and download the page information? Obviously, I'd be supplying the username and password.

In context, let's say I want to check if there are any new news updates on my school account, which I must login to with my school username/password. Could I supply my program with the desired info and somehow get it to pass these parameters to the webform and continue along the page?

like image 823
Chris Avatar asked Jan 09 '10 04:01

Chris


1 Answers

Yes it is possible to programmatically login to a site.

You need to know how your school website handles logins. Say, your school website's login handler is some Login.aspx, and it takes username and password as POST, then you need to send a POST request from your program using WebRequest, adding your username and password as POST variables to your request.

Hope that helps.

like image 137
jrharshath Avatar answered Nov 15 '22 04:11

jrharshath