Home > Archive > ASP .NET > April 2005 > Back Button Issues
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Back Button Issues
|
|
| Tom wilson 2005-04-28, 9:00 pm |
| 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! :)
| |
| Bruce Barker 2005-04-28, 9:00 pm |
| 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" <yeahright@nospam.com> wrote in message
news:0kg2711ubtiq6tqa142nqf1o335234vtpl@
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! :)
>
| |
| shaun duke 2005-04-28, 9:00 pm |
| 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.
| |
| dan.c.roth@gmail.com 2005-04-29, 4:01 am |
| 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! :)
| |
| Tom wilson 2005-04-29, 4:01 pm |
| 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, dan.c.roth@gmail.com wrote:
[color=darkred]
>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:
>code
| |
| Tom wilson 2005-04-29, 4:01 pm |
| 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, dan.c.roth@gmail.com wrote:
[color=darkred]
>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:
>code
|
|
|
|
|