Note that there are some explanatory texts on larger screens.

plurals
  1. PODownloading from website error - Could not find a part of the path
    text
    copied!<p>I am trying to create a quick fix for a problem I am having. All I need to do is download a file from my website to a local computer.</p> <p>I have a website using ASP.NET and C# and I have added the code below to a button click to download a file:</p> <p><strong>WebClient webClient = new WebClient(); webClient.DownloadFile("http://www.mysite.com/myfile.ext", @"C:\test\myfile.ext");</strong></p> <p>which produces the error in the title:</p> <p><strong>Could not find a part of the path 'C:\test\myfile.ext'.</strong></p> <p>The directory does exist on my computer.</p> <p>From what I have read this appears to be a permissions issue on the local computer. I have added full permissions on that directory for the <strong>NETWORK SERVICE</strong> user as I am running <strong>Windows 7</strong>. I also have a user that is running <strong>XP</strong> so I believe the user there would be <strong>ASPNET</strong>.</p> <p>Needless to say none of this has worked and allowed me to download the file. I'm a little out of my element here so I'm not sure what to do. It could be that I'm on the right track and just missed something obvious, or maybe I'm way off base.</p> <p>Anyone have some guidance for me?</p> <p><strong>EDIT</strong></p> <p>The more I think about this, I can't help but think there's a better way to do this.</p> <p>I've downloaded from websites before without ever needing to deal with permissions, so what would be a better simple approach? What am I missing here?</p> <p><strong>ANSWER</strong></p> <p>Thanks, I found exactly what I needed from Hari's responses below.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload