C# - Modify File Permission ASP.NET MVC -


i want modify file's permission, , talking permission 666 / 777 etc. in other words how tio change permission of file 666. goal changing permission of uploaded file on asp.net mvc web app.

  public string uploadfile(httprequestbase currentrequest)     {         string filename = "";         (int = 0; < currentrequest.files.count; i++)         {             if (currentrequest.files[i].contentlength > 0)             {                  string strfilename = guid.newguid().tostring() +                                      path.getextension(currentrequest.files[i].filename);                 currentrequest.files[i].saveas(httpcontext.current.server.mappath("/upload/task/" + strfilename));                  filename = strfilename;             }         }         return filename;     } } 

you should @ file.setaccesscontrol method

public static void setaccesscontrol(     string path,     filesecurity filesecurity ) 

for example how filesecurity's of file

filesecurity fsecurity = file.getaccesscontrol(filepath); 

then create filesystemaccessrule

filesystemaccessrule rule = new filesystemaccessrule(specific_user, filesystemrights.fullcontrol, accesscontroltype.allow); 

and add rule file's filesecurity

file.setaccesscontrol(filepath, fsecurity); 

list of filesystemrights possible values
http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemrights(v=vs.110).aspx


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -