+ Post New Thread
Results 1 to 7 of 7
Web Development Thread, C# Download Files in Coding and Web Development; Dear All, I have in house server and I need to download files from this server by C#.net I use ...
  1. #1
    itdc's Avatar
    Join Date
    Feb 2011
    Posts
    14
    Thank Post
    8
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Question C# Download Files

    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
    Last edited by itdc; 30th March 2014 at 06:36 AM.

  2. #2

    Join Date
    May 2013
    Posts
    30
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Do you get an error?

    Do you use a proxy? If so you may need to use the details for the WebClient to work

  3. #3
    itdc's Avatar
    Join Date
    Feb 2011
    Posts
    14
    Thank Post
    8
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Hi Jimmy,

    Thanks for reply.
    No error only not don't download.
    I don't use proxy

    Thanks.

  4. #4

    vikpaw's Avatar
    Join Date
    Sep 2006
    Location
    Saudi Arabia
    Posts
    5,848
    Thank Post
    671
    Thanked 1,383 Times in 1,145 Posts
    Rep Power
    350
    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.

  5. Thanks to vikpaw from:

    itdc (31st March 2014)

  6. #5
    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,477
    Thank Post
    37
    Thanked 485 Times in 417 Posts
    Rep Power
    109
    Code project to the rescue: Download File Using C# - CodeProject

    Code:
    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

  7. Thanks to nickbro from:

    itdc (31st March 2014)

  8. #6
    itdc's Avatar
    Join Date
    Feb 2011
    Posts
    14
    Thank Post
    8
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks I try it but not working any permissions I need to give it to folder in server?

    Regards,
    DC IT

  9. #7
    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,477
    Thank Post
    37
    Thanked 485 Times in 417 Posts
    Rep Power
    109
    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

SHARE:
+ Post New Thread

Similar Threads

  1. Teachers require to upload downloads files from home.... Forefront Security?
    By BorisAlden in forum Network and Classroom Management
    Replies: 2
    Last Post: 1st December 2010, 08:35 PM
  2. downloaded files
    By leco in forum Windows 7
    Replies: 6
    Last Post: 31st October 2009, 05:59 PM
  3. IE 8 - Not downloading files
    By garethedmondson in forum Windows
    Replies: 5
    Last Post: 18th September 2009, 10:00 PM
  4. Downloading files problem
    By TechSupp in forum Windows
    Replies: 3
    Last Post: 22nd February 2008, 05:06 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •