C# Process.Start

Discussion in 'Programming' started by sgrewal1, Aug 11, 2011.

  1. #1
    Hi,

    I am new to c# and I am trying to download a file from the webpage.
    I am able to download the file by using Process.Start("url of the file"). But the downloaded file gets stored in the download folder of my default browser.

    Is there any way I could change the download folder for the file.

    Thank you
     
    sgrewal1, Aug 11, 2011 IP
  2. capripio

    capripio Member

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #2
    HI sgrewal1,
    I will help you,
    First you need namespace:.
    Using System.net;

    Then make a new class :.
    WebClient webClient = new WebClient();
    And use webclient to download and save location like this:.
    webClient.DownloadFile("location where file download from", @"save location where file will going to save with extension name");
    example:.
    webClient.DownloadFile("http://mysite.com/myfile.txt", @"c:\myfile.txt");
    if need any help pmed me or repost here.
     
    capripio, Aug 12, 2011 IP
  3. p.caspian

    p.caspian Peon

    Messages:
    964
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Thanks a lot, Capripio for sharing...............
    It really works. But Is there anyone present who can download file to Specific location using Process.Start()
     
    p.caspian, Aug 13, 2011 IP
  4. capripio

    capripio Member

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #4
    Well I don't think so there is option for save file...in Process.Start()
     
    capripio, Aug 13, 2011 IP