Questions tagged [varybyparam]
13 questions
16
votes
4 answers
How to implement VaryByCustom caching?
I'm trying to implement functionality to cache certain pages depending on the host. This is because I can have multiple versions of a page which have the same parameters, and where the only difference in terms of a request is the host that is being…

DaveDev
- 41,155
- 72
- 223
- 385
8
votes
1 answer
VaryByCustom not working for session variable
I'm using output cache for a web site with login system. I have global pages which can be accessed by every user. These pages are cached and also use a master page.
<%@ OutputCache Duration="3600" VaryByParam="none" VaryByCustom="userid" %>
I'm…

HasanG
- 12,734
- 29
- 100
- 154
5
votes
2 answers
Caching not working right in my ASP.NET MVC website?
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)…

Pure.Krome
- 84,693
- 113
- 396
- 647
4
votes
1 answer
VaryByParam fails if a param is a list
I've got this action in MVC
[OutputCache(Duration = 1200, VaryByParam = "*")]
public ActionResult FilterArea( string listType, List designersID, int currPage = 1 )
{
// Code removed
}
that fails to present the correct HTML with url…

Sig. Tolleranza
- 499
- 9
- 27
2
votes
1 answer
asp.net mvc4 VaryByParam does not work
My code is as below:
[HttpGet]
[OutputCache(Duration = 90, VaryByParam = "cityCode")]
public ActionResult About(string userName, string cityCode)
{
//do something...
return View();
}
the cache works fine when I access the…

arvin
- 23
- 3
2
votes
1 answer
Manual outputcache refresh
Right now I have OutCache on an action with duration set to 365 days. However depending on some events I would like to clear the cache and there are multiple conditions for clearing cache. Moreover, VaryByParam is not an option.
How can I achieve…

Shyamal Parikh
- 2,988
- 4
- 37
- 78
1
vote
1 answer
Issue with ASP .Net MVC 2.0 Caching
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(
…

gmakrygiannis
- 360
- 3
- 14
1
vote
1 answer
VaryByParam for MVC Model
I have below search model for my MVC application.
public class SearchFilters
{
public SearchFilters()
{
MinPrice = "10000";
MaxPrice = "8000000";
}
public IEnumerable Categories { get; set; }
…

Guruprasad J Rao
- 29,410
- 14
- 101
- 200
1
vote
2 answers
Why does OutputCache attribute require the VaryByParam parameter to be set?
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.

Paul
- 6,188
- 1
- 41
- 63
1
vote
1 answer
MVC - Outputcache - post params - VaryByParam no effect
I have a MVC page being hit by a normal form post with 2 post parameters.
SupplierId and Repayment.
Before adding the form I used Outputcache on the action like:
[OutputCache(Duration = 86400, VaryByCustom = "pageurl")]
public override ActionResult…

Jacob
- 409
- 1
- 6
- 16
1
vote
1 answer
How do I cache at both client & server when VaryByParam != "none"?
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…

Mike
- 7,500
- 8
- 44
- 62
1
vote
1 answer
MVC 4 child action's outputcache attribute not working with VaryByParam value
Is it not possible to cache a child action's output depending on query value?
public class HomeController : Controller
{
public ActionResult About()
{
ViewBag.Message = DateTime.Now.ToLongTimeString();
return View();
}
…

Erhan
- 41
- 1
- 6
0
votes
1 answer
The GetVaryByCustomString method is not fired
The GetVaryByCustomString method is not fired when I place a breakpoint in it.
The action I want to cache depending on the language the user selected:
[OutputCache(CacheProfile = "24HoursCache", VaryByCustom = "lang")]
public ActionResult…

Léo Davesne
- 2,103
- 1
- 21
- 24