I have an action declared as following
[OutputCache(Duration = 3600, VaryByParam = "none")]
public ActionResult Test()
In order to check outputcache setting I added
@DateTime.Now.Ticks.ToString() in view Test.cstml
What troubles me is that when i run http://localhost/EN/Navigation/Test first time, view gets cached and page refresh returns a same number of ticks. Now if i change language and set http://localhost/DE/Navigation/Test number of tick changes, ie. view is not served from cache.
I tried to remove VaryByParam = "none" but is always produces the same results.
What is wrong here, how to serve a cached view not matter what language is used.
Best How To :
VaryByParam varies by the parameters passed in a URL. I.e. The URL www.stackoverflow.com/page?param1=5. Because
DE is a different URL to
EN, the page won't be found in the cache so it requests a new one.
A semicolon-separated list of strings used to vary the output cache. By default, these strings correspond to a query string value sent with GET method attributes, or a parameter sent using the POST method. When this attribute is set to multiple parameters, the output cache contains a different version of the requested document for each specified parameter. Possible values include none, *, and any valid query string or POST parameter name.
Bottom line: It's based on URL, not routing. You are able to configure based on the query string but no more.