c# - How to download files from FTP Server -


i'm trying download file (all kinds of files, exe dll txt etc.). , when try run error comes on:

using (filestream ws = new filestream(destination, filemode.create)) 

this error message:

access path 'c:\riot games\league of legends\rads\solutions   \lol_game_client_sln\releases\0.0.1.41\deploy'(which destination, want  save it) denied. 

here code

void download(string url, string destination)     {         ftpwebrequest request = (ftpwebrequest)webrequest.create(url);         request.method = webrequestmethods.ftp.downloadfile;         request.credentials = new networkcredential("user", "password");         request.usebinary = true;          using (ftpwebresponse response = (ftpwebresponse)request.getresponse())         {             using (stream rs = response.getresponsestream())             {                 using (filestream ws = new filestream(destination, filemode.create))                 {                     byte[] buffer = new byte[2048];                     int bytesread = rs.read(buffer, 0, buffer.length);                      while (bytesread > 0)                     {                         ws.write(buffer, 0, bytesread);                         bytesread = rs.read(buffer, 0, buffer.length);                     }                 }             }         } 

the error explicit , clear: don't have write permissions on c:\riot games\league of legends\rads\solutions\lol_game_client_sln\releases\0.0.1.41\deploy

your program needs permission write file specified location.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -