?
Solved

force a page load on browser back button in c#

Posted on 2012-03-10
3
Medium Priority
?
746 Views
Last Modified: 2012-03-11
I have a webpage http://www.practicelifeintheuktest.co.uk/life-in-the-uk-free-sample-test.aspx  for a quiz test. When user finishes the test and goes to result page and clicks on the browser back button. The page_load event does not fire and session variables which are set in page load are not set and the page does not behave correctly. How can we force page load when user clicks the back button. I have tried a couple of possible solutions like setting the no cache properties but it does not seem to work on this case.

Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays( - 1);
Response.Expires = 0;
Response.CacheControl = "no-cache";

and

Response.Cache.SetCacheability(HttpCacheability.NoCache);
0
Comment
Question by:mmalik15
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 37705398
Unless you are using javascript/AJAX to load the page, clicking on 'Back' does not contact the server, it just displays from the history cache in the browser which is not the same as checking 'cache' when a new link is clicked.  All the things you listed above are only run on the server and never seen when 'Back' is clicked.
0
 

Author Comment

by:mmalik15
ID: 37705459
thanks for the comment but any suggestion how to handle the back button in this case
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37705481
You can't 'handle' the back button from the server because the server isn't involved.  Only if you do your page load with javascript / AJAX can you reload anything from the server.

What happens if you refresh the page after clicking on 'Back'?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question