Pregunta

Id like to show a page non cached, but still take advantage of outputcache. Say a admin would like to see the page updated in real time by adding a query string nocache=1 to the url, then the outputcache wouldnt show the cached version, but if the query string is left off it would. Can I do this?

¿Fue útil?

Solución

The best alternative would probably be to implement a custom cache provider which, when given a certain set of parameters, does not cache the page. Here is one such example:

http://www.haneycodes.net/custom-output-caching-with-mvc3-and-net-4-0-done-right/

Otros consejos

If you create some miscellaneous parameter and configure the output caching to varyByParam, you should be able to call it with different values each time, it should bypass the cache... However I'm not sure this would be the best way to do that. You may want to just create a separate action for the admin to access that is secured.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top