Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 13, 2008 03:24 PM by gspence
May 02, 2008 10:24 AM|LINK
I have developed a setup project for my web application. I need to give the write permissions for a sub-folder. Because, in the runtime, my application will copy files in this folder. So that i need to give write access for this folder at the time of installation.
Can anybody help me to grand permissions for a web sub-folder at the time of installation?
thanks in advance.
May 02, 2008 06:59 PM|LINK
You will need to create a library to run after the installation to set in Custom Actions of your Setup and Deployment project. Take a look to "http://weblogs.asp.net/scottgu/archive/2007/06/15/tip-trick-creating-packaged-asp-net-setup-programs-with-vs-2005.aspx".
That article don´t treats about this, but you can see how you must to use Custom Actions.
However, I think more practical to use the special folders of current user. With special folders you don´t need to worrry about permissions. Take a look to
Environment.GetFolderPath to more informations.
There are another tool like this called "Isolated Storage". Take a look for
Sorry about my English. I don´t speak English so much.
May 03, 2008 04:26 AM|LINK
Thanks for your reply.
Actually I have finished my development process. So i am unable to go for the Isolated Storage system.
What I actually need is just to give the full permission for my folder which will hold some pictures (automatically these are generated) in the run time.
Also already i have used the custom actions in my setup project. but i dont know to develop the library which gives the permissions for my folder.
So please If you can, send me the source for the library. The permissions has to give for all web site users.
May 05, 2008 12:18 PM|LINK
Take a look for "ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref8/html/M_System_IO_DirectoryInfo_SetAccessControl_1_b5965545.htm" from your Visual Studio Documentation (You can paste that address in your browser too).
May 13, 2008 05:03 AM|LINK
At last I found the solution for providing the permissions to my web folder. herewith i have attached the code for all of you.
I have created a console application with the following. This application will be called from my msi setup file and i will pass the installation path as argument for this console application.
static void Main(string args)
string myParam = "";
string myParam2 = "";
if (args.Length > 0)
myParam = args + "\\MyFolder";
myParam2 = args + "\\Reports\\MyConfig.xml";
Console.Write("Starting to apply folder permissions .... \n");
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "C:\\windows\\system32\\cacls.exe ";
myProcess.StartInfo.Arguments = myParam + " /e /t /c /p " + System.Environment.MachineName + "\\ASPNET:F";
myProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
myProcess.StartInfo.Arguments = myParam + " /e /t /c /p NETWORKSERVICE:F";
myProcess.StartInfo.Arguments = myParam2 + " /e /t /c /p everyone:F";
myProcess.StartInfo.Arguments = myParam2 + " /e /t /c /p " + System.Environment.MachineName + "\\ASPNET:F";
Console.Write("\n\n\nProcess Finished .... \nPress any key to continue ...");
catch (Exception ex)
Hope this will help you all. go to command prompt and type and execute "cacls.exe" for additional options available on it.
May 13, 2008 03:24 PM|LINK
Thank you dhanashivam for posting your solution!