Access denied to Temp ASP.NET directory

Christo picture Christo · Feb 24, 2012 · Viewed 15.3k times · Source

Please review my UnauthorizedAccessException ASP.NET error.

Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\8909a2b1\8566823\Nop.Plugin.Feed.Froogle.dll' is denied.

The error has occured since I changed the website to be hosted through VS 2010 IIS from my machines IIS. My solution has previously worked in VS 2010 IIS as I went from VS IIS to Machine IIS back to VS ISS.

My Problem occurs when I copy dlls to the temp directory.

File.Copy(...

I've tested the various permissions on the directory and nothing helped. i also ran the aspnet_regiis -i command in the hope it would restore the desired permissions on the temp directory.

I dont have any problems if I delete the '../Temporary ASP.NET Directory', it only occurs when I try to replace existing files.

File.Copy("source", "c:\windows\microsoft.net\framework\v4\temporary asp.net files\...\###.dll", true);

Any help would be appreciated. Thanks,

Answer

Anonymous picture Anonymous · Apr 12, 2012

I have just spent hours troubleshooting this very same issue. In my case the dlls were from a solution that was checked in to SourceSafe and when copied into the temp folder they were marked ReadOnly. Once I removed the ReadOnly attribute the problem went away...