console application - Creating a Folder in C#, Applying Permissions, But access is still DENIED? -


so have code below creates directory , gives aspnet permissions on folder created. when run webclient.downloadfile method, says folder created still access denied..

ive created folder on c:/ , tried applying permissions self , see get. still access denied.

can help?

 directoryinfo di = directory.createdirectory(path);                     system.security.accesscontrol.directorysecurity dsec = di.getaccesscontrol();                     dsec.addaccessrule(new system.security.accesscontrol.filesystemaccessrule(@"lv38pce00081461\aspnet", system.security.accesscontrol.filesystemrights.fullcontrol, system.security.accesscontrol.accesscontroltype.allow));                     di.setaccesscontrol(dsec); 

here webclient.download file method im calling.
folderid the directory exp: "c:\hello"

webclient webclient = new webclient(); webclient.downloadfile(new uri(reader.value), folderid); console.writeline(folderid + " file downloaded"); 

this method above gives access denied.

on side note: console application... not webpage or web service.

is folderid file data should downloaded or folder want downloaded to? should file.

public void downloadfile( uri address, string filename )

parameters

address type: system.uri uri specified string, download data.

filename type: system.string name of local file receive data.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -