I'm trying to produce a fast solution for any problem I'm getting. All I have to do is download personal files from the web site to a nearby computer.

I've got a website using ASP.Internet and C# and that i have added the code below to some button click to download personal files:

WebClient webClient = new WebClient() webClient.DownloadFile("http://www.mysite.com/myfile.ext", @"C:testmyfile.ext")

which creates the error within the title:

Couldn't find an element of the path 'C:testmyfile.ext'.

Your directory does exist on my small computer.

From things i read this seems to become a permissions problem around the local computer. I've added full permissions on that directory for that NETWORK SERVICE user like me running Home windows 7. I in addition have a user that's running XP and so i believe the consumer there'd be ASPNET.

Obviously none of the has labored and permitted me to download the file. I am a little from my element here so I am unsure how to proceed. Maybe I am on course and merely skipped something apparent, or possibly I am way off base.

Anybody possess some guidance for me personally?


The greater I consider this, I can not help but think there's an easy method to get this done.

I have downloaded from websites before without ever requiring to cope with permissions, what exactly will be a better simple approach? What shall we be held missing here?

Look into the application pool identity type to make certain you're granting permission towards the correct user, see this website for additional particulars.

The consumer running the applying pool utilized by your site must be given permissions to see that file. So, goto IIS > application pools > discover the one for the website > the main one that's under identity.