Reputation: 11340
I'm currently building a website .net/c#.
I'm looking to see if there is a solution to stop browsers caching postbacks.
Most of my forms are encapsulated within updatepanels, so when javascript is enabled all is ok and back is back to previous page.
However when javascript isn't enabled, and I try to stop caching using the code below, I get the awful "page expired" mesage. What I'd like is for the postbacks ignored entirely instead.
Here's the code:
response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache)
response.Cache.SetNoStore()
Is there any way of achieving this or is it a browser thing?
Upvotes: 0
Views: 84
Reputation: 21485
In short - there is no cross-browser way of stopping a page from appearing in the history.
The classic way of doing this is to respond to POST requests with a redirect (response.Redirect("YourPage.aspx?success=1")
).
The other alternative is using UpdatePanel-s (which is what you are doing) or another mechanism for issuing AJAX requests, not classic browser POST-s.
Upvotes: 1