ASP.NET Temporary files cleanup

The Question :

154 people think this question is useful

Can I safely delete the contents of this folder

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root

on a Windows 2003 R2 standard system, given that I am not using IIS (6/7) on it?

If that is the case, could you please point me to the relevant documentation about ASP.NET’s runtime and maintenance tasks such as this?

The Question Comments :

The Answer 1

162 people think this answer is useful

Yes, it’s safe to delete these, although it may force a dynamic recompilation of any .NET applications you run on the server.

For background, see the Understanding ASP.NET dynamic compilation article on MSDN.

The Answer 2

36 people think this answer is useful

Just an update on more current OS’s (Vista, Win7, etc.) – the temp file path has changed may be different based on several variables. The items below are not definitive, however, they are a few I have encountered:

“temp” environment variable setting – then it would be:

%temp%\Temporary ASP.NET Files

Permissions and what application/process (VS, IIS, IIS Express) is running the .Net compiler. Accessing the C:\WINDOWS\Microsoft.NET\Framework folders requires elevated permissions and if you are not developing under an account with sufficient permissions then this folder might be used:

c:\Users\[youruserid]\AppData\Local\Temp\Temporary ASP.NET Files

There are also cases where the temp folder can be set via config for a machine or site specific using this:

<compilation tempDirectory="d:\MyTempPlace" />

I even have a funky setup at work where we don’t run Admin by default, plus the IT guys have login scripts that set %temp% and I get temp files in 3 different locations depending on what is compiling things! And I’m still not certain about how these paths get picked….sigh.

Still, dthrasher is correct, you can just delete these and VS and IIS will just recompile them as needed.


Add a Comment