cachingasp.net-mvc-2role-based

How to disable Caching for certain roles in ASP.Net MVC?


I want to enable caching for all Anonymous users of my site. But for logged in users of certain roles, I want to disable caching. I am using .net4/ASP.Net MVC2. How do I achive this?


Solution

  • OK... To answer my own question.. The short answer is no. There is no built in way to do this. But you can emulate this by dynamically adding a unique time stamp query string viz., ts=1234567890 to urls, for the logged in users you do not want to use caching.