itdc Posted March 30, 2014 Posted March 30, 2014 (edited) Dear All, I have in house server and I need to download files from this server by C#.net I use IIS7 and this code: using (WebClient Client = new WebClient()) { Client.DownloadFile("http://dddd.com/dds/Upload/yuyu/THDS.pdf", "THDS.pdf"); } is not working Any help please. Regards, IT Dubai College Edited March 30, 2014 by itdc
JimmyTown Posted March 30, 2014 Posted March 30, 2014 Do you get an error? Do you use a proxy? If so you may need to use the details for the WebClient to work
itdc Posted March 30, 2014 Author Posted March 30, 2014 Hi Jimmy, Thanks for reply. No error only not don't download. I don't use proxy Thanks.
vikpaw Posted March 30, 2014 Posted March 30, 2014 I'm going to move this thread to the Web Development forum as you might get a better response from there. Or if you prefer the Coding forum might be more apt. 1
nickbro Posted March 30, 2014 Posted March 30, 2014 Code project to the rescue: Download File Using C# - CodeProject private void buttonDownloadFile_Click(object sender, EventArgs e) { string url = @"http://www.thereforesystems.com/wp-content/uploads/2008/08/image35.png"; // Create an instance of WebClient WebClient client = new WebClient(); // Hookup DownloadFileCompleted Event client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); // Start the download and copy the file to c:\temp client.DownloadFileAsync(new Uri(url), @"c:\temp\image35.png"); } void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { MessageBox.Show("File downloaded"); } Use ASYNC 1
itdc Posted March 31, 2014 Author Posted March 31, 2014 Thanks I try it but not working any permissions I need to give it to folder in server? Regards, DC IT
nickbro Posted March 31, 2014 Posted March 31, 2014 Depends how you've set the application pool up. It's either everyone or IIS AppPool\Apppoolname. Give it write access to the folder you need
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now