[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

force a page load on browser back button in c#

Posted on 2012-03-10
3
Medium Priority
?
783 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 84

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 84

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

649 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