Reputation: 7318
I add cache to my application, I have a page which contains several User Control, my problem is I just want to cache the data returned from Controller, but not want to cache all the page content. Since one of my user control is login control, if I cache all the result, then it will behave incorrectly.
my problem is :
1.Is it possible to just cache the data returned from controller ?
2.If a page is cached, can I force a control in the page to be uncached ?
Upvotes: 3
Views: 333
Reputation: 9799
If you want to cache the data you could have the controller stuff it in session and issue it to the view from session when it needs to or get it fresh (and stuff it in session) when it needs to refresh the data.
Upvotes: 0
Reputation: 5131
I assume by caching you mean output caching (caching just the output html returned after processing the view result of controller). What you are looking for is called cache substitution or "donut caching". As far as I know it is not supported in ASP.NET MVC 1 & 2. In the rc of MVC 3 it is supported as you can read here - http://weblogs.asp.net/scottgu/archive/2010/11/09/announcing-the-asp-net-mvc-3-release-candidate.aspx.
Upvotes: 3