Above I configured ASP.NET to by default always cache
content using my “SampleCache” provider whenever output caching is used within
the application.
As a slightly more advanced option, developers can also
configure ASP.NET to dynamically choose which output cache provider to use on a
per-request basis. This is useful for scenarios where you want to have a
slightly richer set of cache semantics. For example, you might want to cache
the “Home” page or "Top 10" requested pages of a site using the
built-in ASP.NET in-memory provider (which will be super fast because the
content will be in-memory), and then cache less frequently requested pages that
get lower traffic on disk.
You can dynamically indicate which output cache provider to
use on a per-request basis by overriding the GetOutputCacheProviderName()
method within the Global.asax file of an application. Below I’m
indicating that for the “Home.aspx” page within my application I want to use the
built-in in-memory ASP.NET output cache provider – and that I then want to use
whatever is registered within the web.config file for every other request:

This ability to easily switch between providers depending on
scenarios ends up enabling a bunch of really powerful scenarios.