Reputation: 1469
We've come up with 3 options for providing administration buttons on Actions/pages with caching and would like to know if there are other options or performance/memory/usability issues to be aware of:
EDIT: Is there a way to "Overload" Actions? i.e. It would be idea if there was a way to call an Action which has an [OutputCache] attribute for non-admin users and an Action with no [OutputCache] attribute for admin users.
Background: We have a very simple blog and wanted to allow Administrative users to Edit/Delete posts and to approve comments. So, we added buttons that are rendered only for administrative uses using the solution shown in asp.net MVC3 razor: display actionlink based on user role - ".If(User.IsInRole("Administrators"))".
Then, we added [OutputCache(Duration = 30)] to that Action and found that everone would see either the Admin version or the plainer - depending on who happened to be the first to request the page after the cache timed out. Duh...
Upvotes: 1
Views: 347
Reputation: 1469
We ended up choosing option "3.Create separate Admin Actions/pages".
This allows us the option of creating a separate website/subdomain for administration and simplifies the caching structure - we likely won't do any caching on the Admin pages.
Upvotes: 1
Reputation: 47375
This may only be a partial answer to your question edit:
AFAIK, you can only create 2 overloads of the same action method: one of them must be a HttpPost, and the other must be a HttpGet, and they (of course) must have different params to compile.
Upvotes: 0