So I've looked for the answer multiple times, and meddled around with permission stuff to no avail, but this code still won't let me download a file to a specified path.
WebClient client = new WebClient();
client.DownLoadFile("http://dl.dropbox.com/u/(My account)/Installer.jar", @"c:\Games\Name\libs");
client.DownLoadFile("http://dl.dropbox.com/u/(My account)/Name.zip", @"c:\Games\Name");
Always gives me: "Access to the path 'c:\Games\Name\libs' is denied."
Also note, using windows XP SP3.
Hi I tried the above code locally and got the same error "Access is denied":
WebClient myWebClient = new WebClient();
myWebClient.DownloadFile("http://localhost:1929/2.png", @"C:\Z\)
Try specifying the filename at the end of the directory, saves locally no problem when i ran it:
WebClient myWebClient = new WebClient();
myWebClient.DownloadFile("http://localhost:1929/2.png", @"C:\Z\FILENAME.jpg")
The App probably doesn't have the permission to write to that folder. If this is a client app, try to run it as an administrator. Otherwise, change the permissions on 'c:\Games\Name\libs' to full control for everyone.
If the access to there is denied try to run as administrator.
If it doesn't work, navigate to the folder C:\Games\Name\libs
, right click it and go to Properties.
Choose the "Security" tab, select at the top list the group of users that will run your program. (Try to use Users (YourName-PC\Users)
).
With it selected, click on Edit at the bottom of the list, and at the bottom list select Full control
under Allow
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With