Sunday, July 22, 2007

Cache: VaryByCustom Modify Global.asax

VaryByCustom:
VaryByCustom allows caching different responses based on a custom string
To use VaryByCustom, override GetVaryByCustomString method in Global.asax

VaryByCustom:Global.asax
Following is a part of application’s global.asax file:

public override string GetVaryByCustomString(HttpContext context, string arg)
{
if(arg == “appName”)
return “appname=” + context.Request.Browser.Browser;
else
return “”;
}

No comments: