From time to time I’ve needed a way to clear ASP.NET cache – you know, the views cached with
<%@ OutputCache Duration="3600" VaryByParam="None" %>. Usually the reason has been that changes in the development server needed to be shown while the caching is still “on”.
I used to do this with a change to web.config (add extra line, undo, save – the file is changed, cache is invalidated), but I wanted something that wouldn’t require me to access the test server every time.
Add that snippet to appropriate page/class (for me, HomeController’s Index() method, as I use ASP.NET MVC) – and whenever your URL has ?emptycache=1 in it, application cache is cleared. As simple as that.