OutputCache don't work and how to solve it

September 12, 2010 ASP.NET C# Troubleshooting
So, you've added something like:
<%@ OutputCache Duration="10" VaryByParam="*" %>
But still your code runs and your breakpoints are reached, eventhough they shouldn't as you've just added server side caching!

Well, the most likely issue is that you break the response way to soon by using Response.End().

Remove the Response.End() and your caching should most likely begin to work as you intended.

Want to know more about why this is an issue with caching? Rick Strahl writes about it in his article: Don’t use Response.End() with OutputCache

Related posts: