How do I use VaryByParam with multiple parameters in MVC?

Jak
Jak
Member
352 Points
151 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: 8240
Total Answered: 1
Total Marked As Answer: 0
Posted On: 08-Dec-2015 02:04

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Moderator
1170 Points
210 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
banner

Blog

Active User (2)

 Log In to Chat