Jump to content

Recommended Posts

Posted (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 by itdc
Posted
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.
  • Thanks 1
Posted

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

  • Thanks 1
Posted

Thanks I try it but not working any permissions I need to give it to folder in server?

 

Regards,

DC IT

Posted
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...