If I have a page with outputcaching (let’s call it Employees.aspx) which accepts one parameter (through querystring) called Company like this:
http://www.example.com/Employees.aspx?Company=Google
How can I avoid duplicate page cache entries for differently cased URLs like:
http://www.example.com/Employees.aspx?Company=GOOGLE http://www.example.com/Employees.aspx?Company=GOoGlE
I’ve enabled output caching through the OuputCaching directive as follows:
<%@ OutputCache Duration='300' VaryByParam='Company' %>
Is there any way to programatically set what the ‘unique cache key’ for this particular request should be
One hack-esque method of doing it would be to do a VaryByCustom (instead of VaryByParam) and do the .ToLower/.ToUpper in there.
Change the OutputCache directive to something like this:
…and add an override in Global.asax.cs for GetVaryByCustomString: