Hi, I'm trying to write a C# program that can supply a username and password to a website's login screen. After my C# program logs into the website, it needs to select a checkbox next to the file name it wishes to download. Then my program needs to select the download button at the bottom of the web page so it can download the file to a local path. The name of the website file my program needs to download from this website changes on a regular basis. That is why I cannot programatically specify the name of the file I want to download using WebRequest or WebClient objects. I must instead make my program select the checkbox next to the file that is available for downloading and then click on the download button at the bottom of the web page. This way, my program will be able to download the file without ever knowing the name of the file stored on the website. Does anyone know how I can write such a program in C#
I believe there is a way to do something like this in Java using the WebConversation object, but I have no idea how to do this in C#. Any help would be greatly appreciated. Thanks.

How do I login to a website and download files in C#?
ARASKAS
NAntZ
hi,
sure you can do that in c#
the login page when you click sign in send the user name and password to a particular address like normal login webform you need to know this address and the paramters that send with it to allow you to login and the method"get\set" then you can directly use httpwebrequest and response with this login address in normal cases this page send to you a cookie you can use request.cookiecontainer and use it with every page you request from this site something like this note this is the way of the site that i use may be your site has different way
HttpWebRequest request;
HttpWebResponse response;
CookieContainer cookies;
string url = string.Format("http://site.com/login .login={0}&passwd={1}", cboUserName.Text, txtPassWord.Text);
request = (HttpWebRequest)WebRequest.Create(url);
request.AllowAutoRedirect = false;
request.CookieContainer = new CookieContainer();
response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode != HttpStatusCode.Found)
{
//ToDo: if the page wasn't found raise Exception //instead of this textmessage MessageBox.Show("Something Wrong");
response.Close();
request.KeepAlive = false;
return;
}
cookies = request.CookieContainer;
response.Close();
request = (HttpWebRequest)WebRequest.Create(http://site.com/Reqyestedoage.html);
request.AllowAutoRedirect = false;
request.CookieContainer = cookies;
response = (HttpWebResponse)request.GetResponse(); using (Stream s = response.GetResponseStream())
{
StreamReader sr = new StreamReader(s);
string line;
while (!sr.EndOfStream)
{
//todo read the page contents
}
if you have the same senario then you just use the cookies container with every request from this site
i don't know about web.conversation but there is a webClient in C# also you can use it
hope this helps
Valetnin Bornand
hello
i don't know what's the data you recieved looks like so i can't tell but there is a treeview control you can use , also there is a listview control you might use it , i guess both of them has option for making a checkbox for each node
hope this helps