I'm getting a Unauthorized Access Exception
- in a file wich I can delelete manually.
- in a folder where I'm able to delete by code other files
- and the file isn't marked as read only
- besides, I'm using windows XP in an standalone PC and I have not assigned any permissions to the folder or the file.
- any other process is using the file
If it helps, this is the code where the exception ocurr:
protected void DeleteImage(string imageName)
{
if (imageName != null)
{
string f = String.Format("~/Images/{0}", imageName);
f = System.Web.Hosting.HostingEnvironment.MapPath(f);
if (File.Exists(f))
{
if (f != null) File.Delete(f);
}
}
}
Why could this happen?