views:

102

answers:

2

I want to disable Browser Caching in a specific View.

I tried Response.Cache.SetCacheability(HttpCacheability.NoCache); in a controller that returns the View, but that does not work.

Any suggestions are greatly appreciated.

Thank you.

A: 

Try using the meta tag directly

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

put that at the top of your header. although the Response.Cache call is supposed to just put that in for you.

RHicke
Unfortunately that did not work because the View has the MaterPage. If I put it in the MasterPage than the rest of the views will have the browser cache turned off.Thanks for the suggestions though.
Edward N.
You could cheat and place a timestamp on all of the links to this specific view. Kind of a hack but it would work for anyone who doesn't go to the view directly
RHicke
A: 

Edward,

I actually saw a great suggestion here on SO for this very issue (tho based on logging out of a session and wanting the pages to expire) that would work perfectly for you:

http://stackoverflow.com/questions/1927079/how-to-restrict-user-going-back-to-previous-page-when-clicked-on-browser-back-but

hope this helps...

jimi