3

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?

Chris Marisic
  • 32,487
  • 24
  • 164
  • 258

1 Answers1

2

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
  • 992
  • 1
  • 8
  • 16
  • This is the MVC documentation http://msdn.microsoft.com/en-us/library/system.web.mvc.outputcacheattribute.varybyparam.aspx – airmanx86 Jul 05 '10 at 05:12