Hi folks,
i'm trying to use OutputCaching in my ASP.NET MVC website. Problem is, when i try and change the value of one my querystring params, it's returning the data for the first item that was requested!
Here's my code (with the param names changed) ...
[ApiAuthorize]
[HandleErrorAsJson]
public class SearchController : Controller
{...
I'm looking for a way to cache a page at both the client and the server while varying the server's output cache by a querystring parameter "Version".
With this tag:
<%@ OutputCache Duration="10" Location="Any" VaryByParam="none" %>
I get these headers:
HTTP/1.1 200 OK
Cache-Control: public
Content-Type: text/html; charset=utf-8
Expi...
I've done zero research on this, I'm just curious.
The OutputCacheAttribute class in ASP.NET MVC requires a value for Duration and VaryByParam. I get why Duration is required, but not VaryByParam.
...
I am using OutputCache on an Action like this:
[OutputCache(Duration = 14400, VaryByParam = "none")]
public ContentResult Catalog()
{
return ...;
}
and my RegisterRoutes function in Global.asax.cs contains the route:
routes.MapRoute(
"XMLRoute", // Route name
"{site}/catalog.xml", // URL with parameters
new { controller ...