Click here to Skip to main content
15,906,645 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I have few websites, at a regular interval, I need to download some log files and some documents my clients posted.
My sites provides basic authentication (pops login box for username and password, username:password@sitename.com).
I want to creat an app which logs into my sites and download the files for me.
I know how to download the files but not understanding how to login.

Files are in the folder www.site-name.com/Archit/downs/

Please provide me some reference.

Thanks in Advance.

Attaching screen shot.
[Image]
Posted
Updated 13-Jun-11 18:53pm
v4

Most typically your download page is a simple form which require HTTP request using the method "POST".

In this case, you have to use the class System.Net.HttpWebRequest. However, to create an instance of this class you need the class System.Net.WebRequest for its factory method System.Net.FileWebRequest.Create. Actual run-time type is defined by the URI.

Please see the code sample here:
http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx[^]. Don't forget: you need to set the Method property to "POST".

When authentication is successful you can proceed with file downloading or any other requests which needed authentication.

—SA
 
Share this answer
 
[^]

or Try this [^]
will really help you out
 
Share this answer
 
v2
Comments
Archit88 14-Jun-11 0:55am    
1st link i tried... but as i have written this is basic auth,

i also tried Google and still trying but didn't got anything useful....
Karwa_Vivek 14-Jun-11 0:56am    
what do you mean by BASIC AUTHENTICATION..
can you explain it please
According to Wikipedia[^] you need to set the Authorization HTTP header, if that is what you mean by 'basic authentication'.

However, I think it isn't, I think what you mean is that you have a login page that posts data to a script, and that initialises a session. For this, as SA says, you will need to send a request that causes the server to create a session, and then preserve the session cookie for the download requests. This will typically be a POST to the same target as the login box on your page, passing the user name and password (and any other login parameters) as they are sent back from the HTML page.

Just checked your image, I think the first thing is what you want after all. Also, your image provider has links to porn, you might want to host that screenshot somewhere else.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900