By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

How do i download a file that requires password

P: 1
Greeting all,

I was trying to use C# to download a file that needs log-in:

string strDownloadURL = "http://www.cchere.com/list.rdl";
WebClient Client = new WebClient();
Client.DownloadFile(strDownloadURL, "c:\\s.rdlc");

However the code returns "Authorization Failure" error, because that URL requires login.

I DO have the username and password that will allow me to download the file from web browser. How can i do this from C# code?

Thanks a lot!

Gary
Dec 29 '08 #1
Share this Question
Share on Google+
1 Reply


Plater
Expert 5K+
P: 7,872
You will need to send the authenticate header with your request.
Check the http documentation for how to create it, or, I *THINK* the HttpWebRequest class has a way to add the credentials.
Dec 29 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.