How to Clear Your ASP.NET Cache
When you compile a web application, the compiled code is stored in the Temporary ASP.NET Files folder. This folder is a subdirectory of the .NET framework installation directory. While this setup is efficient, it can sometimes lead to strange caching behavior, especially in the Console or WebAccess. If an IIS reset doesn’t resolve the issue, clearing the Temporary ASP.NET Files might just do the trick.
Do not delete the Temporary ASP.NET Files folder itself. Only clear its contents.
Using the Command Line Interface (CLI)
-
Stop IIS Before making any changes, ensure that IIS is stopped to avoid conflicts.
-
Locate Your Temporary Directory Depending on your system configuration, the Temporary ASP.NET Files folder can be found in several locations. Here are the most common ones:
# Delete all files from these directories
C:\Windows\Microsoft.NET\Framework\v4.0.30319\"Temporary ASP.NET Files"
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\"Temporary ASP.NET Files"Additionally, you may want to check these directories:
%temp%\"Temporary ASP.NET Files"
C:\Users\[youruserid]\AppData\Local\Temp\"Temporary ASP.NET Files" -
Restart IIS Once you’ve cleared the contents of the folder, restart IIS to apply the changes.
Why This Matters
Clearing the Temporary ASP.NET Files can resolve issues caused by corrupted or outdated cached files. It’s a simple yet effective troubleshooting step that can save hours of debugging. Just remember to handle these files with care to avoid disrupting your application’s functionality.