views:

26

answers:

1

Does outputcaching VaryByParams in webforms understand route parameters? Such that if I have a route similar to "Content/{filename}/{more}" that I could do VaryByParams="filename" and have it return cached results based on filename and ignore any values in the more?

+1  A: 

VaryByParam only work with query string when HTTP method is GET, and parameters (i.e. values in the form and query string) when HTTP method is POST. Unless you are using query string for routing I do not think that it will work.

Please take a look at the documentation of @OutputCache.

http://msdn.microsoft.com/en-us/library/hdxfb6cy.aspx

May be you can consider writing your own caching using C# in the code behind of the page instead of relying on @OutputCache.

airmanx86
This is the MVC documentationhttp://msdn.microsoft.com/en-us/library/system.web.mvc.outputcacheattribute.varybyparam.aspx
airmanx86