Is it possible to output cache controller actions differently based on user role? or if they are authenticated or not?
The output cache enables you to cache the content returned by a controller action. That way, the same content does not need to be generated each and every time the same controller action is invoked. Imagine, for example, that your ASP.NET MVC application displays a list of database records in a view named Index.
Cache Profile It is an alternative to configuring output cache properties by modifying properties of the [OutputCache] attribute. It offers a couple of important advantages which are as follows. Controls how controller actions cache content in one central location.
Output Caching enables us to cache the content returned by any controller method so that the same content does not need to be generated each time the same controller method is invoked. Introduction. The main purpose of using Output Caching is to dramatically improve the performance of an ASP.NET MVC Application.
Any (Default)- Content is cached in three locations- the Web Server, any proxy Servers and the Web Browser. Client- Content is cached on the Web Browser. Server- Content is cached on the Web Server. ServerAndClient- Content is cached on the Web Server and the Web Browser.
Take a look at VaryByCustom.
http://msdn.microsoft.com/en-us/library/system.web.httpapplication.getvarybycustomstring.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With