Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 14, 2008 11:46 AM by r00Tsecurity
Apr 20, 2008 08:23 PM|LINK
I have a simple issue.. I just need to grant write/full access for a specified directory after my web setup project commits installation.
What I did is:
I created an installer class library for setup project. And I added the project into commit section of installation. After committing, my installer class library is executing and trying to give access for 3 directories (for uploading process). But I couldn't
find the right code for giving full permission for a directory. Below, you can see my code which is trying to give access.
const string account1 = @"NT AUTHORITY\NETWORK SERVICE";
public override void Commit(System.Collections.IDictionary savedState)
string targetDirectory = Context.Parameters["targetdir"] + "\\upload_directory";
SetSecuritySettings (targetDirectory , account1);
public static void SetSecuritySettings(String path, String account)
AddDirectorySecurity(path, account, fileRights, AccessControlType.Allow);
public static void AddDirectorySecurity(string path, string account, FileSystemRights rights, AccessControlType controlType)
DirectorySecurity dSecurity = Directory.GetAccessControl(path);
System.Security.AccessControl.FileSystemAccessRule fsar = new System.Security.AccessControl.FileSystemAccessRule(account, rights, controlType);
catch (Exception ex)
MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
But this code just adds special permissions and it doesn't work for my website to write that folder. So I found the code below which is a
command prompt code:
icacls.exe C:\INETPUB\WWWROOT\TARGET_SITE /grant "IIS_WPG":(F,WDAC) /T
and it's the same result like the first one. Doesnt' workk. So I still could not find any way to give full access permission for a directory.
Any Ideas? Does anybody must have to be done this before?
Thanks in advance.
Apr 30, 2008 10:06 AM|LINK
i am also need to give full rights for the IUSR account of the IIS to a particular directory. did you get any solution for this?
if you know let me too.
thanks in advance.
May 14, 2008 07:56 AM|LINK
no. I haven't found any good solution
May 14, 2008 08:26 AM|LINK
go thru this link. here i have given the solution for it.
May 14, 2008 11:46 AM|LINK
thanks I'll try it.