How do I use VaryByParam with multiple parameters in MVC?

Jak
Jak
908 Points
132 Posts

Hi,

I am working on OutputCache with varyByParam property. I successfully use this for single param in action as

[ChildActionOnly]
[OutputCache(Duration = int.MaxValue, VaryByParam = "IsSessionExpired,IsMobileDevice")]
public PartialViewResult PartialViewChat(string IsSessionExpired, string IsMobileDevice)
{

I am using comma to separate two parameter as above code. but It's not working.

Please help.

Views: 10469
Total Answered: 1
Total Marked As Answer: 0
Posted On: 08-Dec-2015 02:04

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
4916 Points
27 Posts
         

Use semicolon (;) separate parameter

[ChildActionOnly]
[OutputCache(Duration = int.MaxValue, VaryByParam = "IsSessionExpired;IsMobileDevice")]
public PartialViewResult PartialViewChat(string IsSessionExpired, string IsMobileDevice)
{
Posted On: 27-Apr-2017 08:45
 Log In to Chat