Varying the Output Cache by Browser
A better way to create different cached versions of a page that depend on the type of browser used to request the page is to use the VaryByCustom attribute. This attribute accepts the special value browser. When VaryByCustom has the value browser, only two attributes of the browser are considered important: the type of browser and its major version.
For example, a page request from Internet Explorer results in a different cached version of the page than does one from Firefox. A page request from Internet Explorer 8 rather than Internet Explorer 6 also results in a different cached version. Any other variations in the User-Agent header are ignored.
The page in Listing 29.6 illustrates how you can use the VaryByCustom ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access