U
Umut Tezduyar
My web site user should change some files in the root folder. Why the
following code is not working.
I dont want to manually give permission for the asp.net account for each
file. Instead, i want to give permission that the caller can write to the
specified file.
I have investigated the msdn and web. Is this information is hidden ?? Can
any one help me about this.
string path = System.Web.HttpContext.Current.Server.MapPath(string.Empty) +
@"\";
string file = path + this.insertedcontrolName;
// Enable write permission for the file.
FileIOPermission fileIOPerm1 = new
FileIOPermission(FileIOPermissionAccess.AllAccess, file);
fileIOPerm1.AddPathList(FileIOPermissionAccess.Write, path);
fileIOPerm1.AddPathList(FileIOPermissionAccess.Read, path);
fileIOPerm1.Assert ();
// Writing to the file
TextWriter writer = new System.IO.StreamWriter (file, false,
System.Text.Encoding.UTF8);
writer.Write (this.html);
writer.Close ();
following code is not working.
I dont want to manually give permission for the asp.net account for each
file. Instead, i want to give permission that the caller can write to the
specified file.
I have investigated the msdn and web. Is this information is hidden ?? Can
any one help me about this.
string path = System.Web.HttpContext.Current.Server.MapPath(string.Empty) +
@"\";
string file = path + this.insertedcontrolName;
// Enable write permission for the file.
FileIOPermission fileIOPerm1 = new
FileIOPermission(FileIOPermissionAccess.AllAccess, file);
fileIOPerm1.AddPathList(FileIOPermissionAccess.Write, path);
fileIOPerm1.AddPathList(FileIOPermissionAccess.Read, path);
fileIOPerm1.Assert ();
// Writing to the file
TextWriter writer = new System.IO.StreamWriter (file, false,
System.Text.Encoding.UTF8);
writer.Write (this.html);
writer.Close ();