Yes. In your page:
<%@ OutputCache Duration='60' VaryByParams='abc;xyz' VaryByCustom='browsermajorversion' %>
In your global.asax file:
VB.NET
Public Overrides Function GetVaryByCustomString(context As HttpContext, custom As String) As String
If custom.ToLower() = 'browsermajorversion' Then
Dim browser As HttpBrowserCapabilities = context.Request.Browser
Return browser.Browser + ' ' + browser.MajorVersion
Else
Return MyBase.GetVaryByCustomString(context, custom)
End If
End Function ’GetVaryByCustomString
C#
public override string GetVaryByCustomString(HttpContext context, string custom)
{
if (custom.ToLower() == 'browsermajorversion') {
HttpBrowserCapabilities browser = context.Request.Browser;
return browser.Browser + ' ' + browser.MajorVersion;
}
else
{
return base.GetVaryByCustomString(context, custom);
}
}
Share with