Loading of URI file (C#)



  • Interests the possibility of using a browser to download the file at the local address. That is, not to indicate the way to preserve it, but to do so, the browser is built. That's why copying the file doesn't work.

    Method DownloadFile(String, String) Class WebClientwhich allegedly allows it to be done. But I can't figure it out.

    Okay. How to correctly declare the parameters as: - First: new Uri("c:\\myfile.txt") (if possible). - The second, "c:myfile.txt"?

    Or is there another way to resolve my question?



  • use a browser to download the file at the local address.

    If you have to open a file on WebBrowser, you can do that:

    using System.Windows.Forms;
    

    var f = new Form();
    var b = new WebBrowser() { Parent = f, Dock = DockStyle.Fill };
    b.Navigate(@"C:\Temp\test.txt");
    f.ShowDialog();


    UPDATE:

    WebClient.DownloadFile(url, path) is designed to download files from web servers. If you don't have a web server on your computer or it's off or not in the mood to work with that url, there's a mistake.


    Brauser gets the way to Downloads, reading the value from the register.

    HKEY_CURRENT_USER
    \Software
    \Microsoft
    \Windows
    \CurrentVersion
    \Explorer
    \User Shell Folders
    {374DE290-123F-4565-9164-39C4925E467B} = %USERPROFILE%\Downloads


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2