Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Redirect when Back Button is clicked

New Here ,
Jun 03, 2010 Jun 03, 2010

Copy link to clipboard

Copied

I have 4 pages in my application:

Page1.asp (form page using the POST Method)

Page2.asp (Insert to Database script + Redirect to Page3.asp)

Page3.asp (Page displaying the the confirmation of insertion)

The problem I'm facing is that once on Page3.asp (confirmation page), if the user hits the Back Button, it brings him back to Page1.asp with the form already filled with data previously entered. Eventually, the data can be inserted twice.

Is there a way to redirect the user to say Page4.asp when clicking the back button from Page3.asp?

TOPICS
Server side applications

Views

1.0K
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 03, 2010 Jun 03, 2010

Copy link to clipboard

Copied

Declare a session variable on page 2 and add a conditional if/else region on page 1 where if session is set then show alternative content else display form.

You can have the entire application on one page using the method mentioned where if post or session variable isset then display confirmation message else display form.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 04, 2010 Jun 04, 2010

Copy link to clipboard

Copied

I tried that but when the user clicks the Bak Button from the Browser, it doesn't see the Session Variable right away, unless the page refreshes. Is there a way to refresh that page when the user clicks the Back Button?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 04, 2010 Jun 04, 2010

Copy link to clipboard

Copied

Sorry I can't help because a simplified version of your code example did not display correctly in your post!!!

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2010 Jun 04, 2010

Copy link to clipboard

Copied

The most common method is to not let the browser cache the page - so that a new page must be pulled from the server. Here's some tips:

http://www.4guysfromrolla.com/webtech/111500-1.shtml

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 04, 2010 Jun 04, 2010

Copy link to clipboard

Copied

LATEST

clear all inputs everytime the page is loaded,

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines