Author: sudeepunnikrishnan | Posted on: 10/30/2008 10:48:02 AM | Views : 444

 I have a .aspx page that tries to overwrite a file on the filesystem in case any changes are made. I am running in to security issues when I try to perform the operation. It gives me an access denied error pointing to System.Security.Permissions.FileAccess.Write. The code is as follows:-
1 FileStream fs = new FileStream(Request.PhysicalApplicationPath + "\\App_Themes\\" + Token.Instance.Store.Settings.StoreTheme + "\\Scriptlets\\Custom\\" + Scriptlet.scppart + "\\" + tempPart + ".htm", System.IO.FileMode.Create, System.IO.FileAccess.Write);
2 System.IO.StreamWriter writer = new System.IO.StreamWriter(fs);
3 writer.Write(changedContent);
4 writer.Close();
...

Go to the complete details ...