asp.net - How do I control reloads when using the back button in the browser? -
I have an ASP.NET application that has a heavily major page; the contents of this main page are seldom changed Apart from the action taken on the same page.
When I retrieve the browser from the cache by pressing the "back" button in the user browser, to contact the server every time, is it being forced to render this page again?
Thanks, Jonas
The short answer is: You can not.
I think the closest you can do is to include something related to your webpage, especially caching and termination like:
& Lt; Meta HTTP-equivalent = "EXPIRES" content = "[some date / time in the future]" & gt;
and
& lt; Meta HTTP-EQUIV = "cache-control" content = "public" & gt;
Once you are sent to the client browser in the web page provided to you, then you just hope the browser, on the user who clicks the back button, on one of your web servers Rather than inciting another request / reaction cycle, the "cached" version of your page, to which your web page can be re-requested and re-presented. Although you will not have any control over it, and it is completely below how the browser wants to handle it, I believe most modern browsers will request the page again, however.
ASP.NET Another way to prevent re-rendering of the page is to control it on the server-side
Instructions within your ASP.NET web page, like this:
& lt;% @ OutputCache period = "600" VaryByParam = "none"%>
This is the most basic, @Output cache control will cache your provided ASP.Net page for a certain number of seconds (above 600 examples) so that after that page Will result in the ASP.NET runtime, rather than the user re-rendered version of the page, re-processing and re-submitting the whole page. Keep in mind that this is not user-specific, though.
More information about page output caching (which is probably the closest, what will you do afterwards):
Comments
Post a Comment