468,771 Members | 1,459 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,771 developers. It's quick & easy.

Back Button Issues

I'm developing an application that is a benefits enrolment website.
The benefits can be of any type in any order as stored in a SQL
server. On each page is a Back and Next button. At a certain point
in the initialization of the app, I determine a navigational
structure; what benefit is first, second, etc., therefore, which page
to display first, second and so on.

In session memory I store an array of page URL's and a single value
called "ThisPage". So if "ThisPage" = 3, I look at URLs(3) and it'll
say something like "LTD.aspx". This is the Next button code:

URLs = Session("URLs")
Session("ThisPage") += 1
Response.Redirect(URLs(Session("ThisPage")))

This works better than I expected. I could have ALMOST used a single
page for everything. Anyways, this works flawlessly until someone
hits the Browser back button. We go back but since I didn't click MY
back button, the above values never get updated and the navigation is
thrown out of sync. I could 'browser back' 4 times from page 6 to
page 2 and my session tracking still thinks we're on page 6. If we
hit next it goes to Page 7, not 3.

How does one deal with this? Is there some way of knowing the user
hit the browser's back button so I could execute MY back button's code
and keep the navigation in sync?

Or are there better methods for dynamic navigation?

(I'd rather not disable the browser history and the browser back
button functionality, it seems sloppy to me)

Thanks! :)

Nov 19 '05 #1
5 2085
store the current page idx in a hidden field or viewstate as its only
required on a postback (next or previous).

-- bruce (sqlwork.com)
"Tom wilson" <ye*******@nospam.com> wrote in message
news:0k********************************@4ax.com...
I'm developing an application that is a benefits enrolment website.
The benefits can be of any type in any order as stored in a SQL
server. On each page is a Back and Next button. At a certain point
in the initialization of the app, I determine a navigational
structure; what benefit is first, second, etc., therefore, which page
to display first, second and so on.

In session memory I store an array of page URL's and a single value
called "ThisPage". So if "ThisPage" = 3, I look at URLs(3) and it'll
say something like "LTD.aspx". This is the Next button code:

URLs = Session("URLs")
Session("ThisPage") += 1
Response.Redirect(URLs(Session("ThisPage")))

This works better than I expected. I could have ALMOST used a single
page for everything. Anyways, this works flawlessly until someone
hits the Browser back button. We go back but since I didn't click MY
back button, the above values never get updated and the navigation is
thrown out of sync. I could 'browser back' 4 times from page 6 to
page 2 and my session tracking still thinks we're on page 6. If we
hit next it goes to Page 7, not 3.

How does one deal with this? Is there some way of knowing the user
hit the browser's back button so I could execute MY back button's code
and keep the navigation in sync?

Or are there better methods for dynamic navigation?

(I'd rather not disable the browser history and the browser back
button functionality, it seems sloppy to me)

Thanks! :)

Nov 19 '05 #2
Tom,
This is only a thought, and will generate some additional overhead, but
....
during the initialisation can you put a reverse lookup table into a
session variable.

Then onload query the reverse lookup to retrieve the pages order in the
navigation structure and
Reset Session("ThisPage") to the correct value.

Then when you your user hits back or whatever the navigation will be
kept in sync.

Nov 19 '05 #3
Solution to the Back button problem for IE 5.5 and above.

1) Get rid of the cache

Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");

2) set SmartNavigation = true

Daniel Roth
MCSD.NET

Tom wilson wrote:
I'm developing an application that is a benefits enrolment website.
The benefits can be of any type in any order as stored in a SQL
server. On each page is a Back and Next button. At a certain point
in the initialization of the app, I determine a navigational
structure; what benefit is first, second, etc., therefore, which page
to display first, second and so on.

In session memory I store an array of page URL's and a single value
called "ThisPage". So if "ThisPage" = 3, I look at URLs(3) and it'll
say something like "LTD.aspx". This is the Next button code:

URLs = Session("URLs")
Session("ThisPage") += 1
Response.Redirect(URLs(Session("ThisPage")))

This works better than I expected. I could have ALMOST used a single
page for everything. Anyways, this works flawlessly until someone
hits the Browser back button. We go back but since I didn't click MY
back button, the above values never get updated and the navigation is
thrown out of sync. I could 'browser back' 4 times from page 6 to
page 2 and my session tracking still thinks we're on page 6. If we
hit next it goes to Page 7, not 3.

How does one deal with this? Is there some way of knowing the user
hit the browser's back button so I could execute MY back button's code and keep the navigation in sync?

Or are there better methods for dynamic navigation?

(I'd rather not disable the browser history and the browser back
button functionality, it seems sloppy to me)

Thanks! :)


Nov 19 '05 #4
That made absolutely no difference. I can use the browser's back
button just as much with or without it.

Do I have to put this at the top of every page in the project?
On 28 Apr 2005 19:04:47 -0700, da********@gmail.com wrote:
Solution to the Back button problem for IE 5.5 and above.

1) Get rid of the cache

Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");

2) set SmartNavigation = true

Daniel Roth
MCSD.NET

Tom wilson wrote:
I'm developing an application that is a benefits enrolment website.
The benefits can be of any type in any order as stored in a SQL
server. On each page is a Back and Next button. At a certain point
in the initialization of the app, I determine a navigational
structure; what benefit is first, second, etc., therefore, which page
to display first, second and so on.

In session memory I store an array of page URL's and a single value
called "ThisPage". So if "ThisPage" = 3, I look at URLs(3) and it'll
say something like "LTD.aspx". This is the Next button code:

URLs = Session("URLs")
Session("ThisPage") += 1
Response.Redirect(URLs(Session("ThisPage")))

This works better than I expected. I could have ALMOST used a single
page for everything. Anyways, this works flawlessly until someone
hits the Browser back button. We go back but since I didn't click MY
back button, the above values never get updated and the navigation is
thrown out of sync. I could 'browser back' 4 times from page 6 to
page 2 and my session tracking still thinks we're on page 6. If we
hit next it goes to Page 7, not 3.

How does one deal with this? Is there some way of knowing the user
hit the browser's back button so I could execute MY back button's

code
and keep the navigation in sync?

Or are there better methods for dynamic navigation?

(I'd rather not disable the browser history and the browser back
button functionality, it seems sloppy to me)

Thanks! :)


Nov 19 '05 #5
I put this in every page in the project. I can use the back button as
much as I please. Did I miss something?

On 28 Apr 2005 19:04:47 -0700, da********@gmail.com wrote:
Solution to the Back button problem for IE 5.5 and above.

1) Get rid of the cache

Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");

2) set SmartNavigation = true

Daniel Roth
MCSD.NET

Tom wilson wrote:
I'm developing an application that is a benefits enrolment website.
The benefits can be of any type in any order as stored in a SQL
server. On each page is a Back and Next button. At a certain point
in the initialization of the app, I determine a navigational
structure; what benefit is first, second, etc., therefore, which page
to display first, second and so on.

In session memory I store an array of page URL's and a single value
called "ThisPage". So if "ThisPage" = 3, I look at URLs(3) and it'll
say something like "LTD.aspx". This is the Next button code:

URLs = Session("URLs")
Session("ThisPage") += 1
Response.Redirect(URLs(Session("ThisPage")))

This works better than I expected. I could have ALMOST used a single
page for everything. Anyways, this works flawlessly until someone
hits the Browser back button. We go back but since I didn't click MY
back button, the above values never get updated and the navigation is
thrown out of sync. I could 'browser back' 4 times from page 6 to
page 2 and my session tracking still thinks we're on page 6. If we
hit next it goes to Page 7, not 3.

How does one deal with this? Is there some way of knowing the user
hit the browser's back button so I could execute MY back button's

code
and keep the navigation in sync?

Or are there better methods for dynamic navigation?

(I'd rather not disable the browser history and the browser back
button functionality, it seems sloppy to me)

Thanks! :)


Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by bigbinc | last post: by
4 posts views Thread by VB Programmer | last post: by
8 posts views Thread by Shimon Sim | last post: by
3 posts views Thread by Robert Megee | last post: by
6 posts views Thread by Tony Doyle | last post: by
7 posts views Thread by Sridhar | last post: by
3 posts views Thread by MattB | last post: by
1 post views Thread by mrboyer79 | last post: by
8 posts views Thread by =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.