Clear All ASP.NET Cache/Static Objects Programmatically

Posted in ASP.NET

I used to re-save Web.config or Recycle a website in IIS when I wanted to delete all ASP.NET website’s cache / reset all static objects, or basically restart the application.

This piece of code does it, programmatically:

HttpRuntime.Close();

So I created a little .ashx/MVC action to do so and access it through the browser.

Have in mind that this will reset the application, including Sessions and static variables, so never use it on production.

Tags: ,



Page optimized by WP Minify WordPress Plugin