Need help with AJAX History Woes


J

JT

AJAX History Points and General Browser Functionality

I am attempting to retrofit a web application that had a rudimentary,
yet mostly effective navigation infrastructure that, when properly
utilized, allowed navigating forward and backward through AJAX states
and other pages through the use of additional <asp:Button> objects
labeled "Back" to perform special code for restoring previous states.
There was an elaborate stack push and pop algorithm for this. The
effect was very similar to what is described in Diagram 1 (AStatex
refers to an AJAX related state of the page). The reason for this is
so that it takes away the reliance on the contrived Back button and so
that accidentally hitting the browser's back button or hitting the
Backspace key won't cause a loss of state.

Diagram 1
Page1 -> Page2.AState1 -> Page2.AState2 -> Page2.AState3 -> Page3
Using contrived Back button
Page3 -> Page2.AState3 -> Page2.AState2 -> Page2.AState1 -> Page1

The intent is to utilize the ASP.NET 3.5 ability to add history points
via the bookmarking feature of the browser. I have read a non-trivial
amount about this technique, however the problem I am experiencing is
that when either redirecting to a new page, performing a cross-page
postback, or some other way of leaving a page, the history points
programatically added for the previous page are now lost, causing the
previous page's AJAX state history to be lost.

Referring to Diagram 2, I can return to Page2 with the last state
restored, as a function of the built-in browser functionality, but if
I hit the browser's back button again, it takes me back to Page1.

Diagram 2
Page1 -> Page2.AState1 -> Page2.AState2 -> Page2.AState3 -> Page3
Using AJAX History Points, the ScriptManager.OnNavigate method and
Browser's back button
Page3 -> Page2.AState3 -> Page1

I had thought about attempting to use a combination of pushing state
information onto the original stack object so that it could be
restored in instances of navigating back to a different page, such as
Page2 and somehow have all of the browser's history points remaining
intact for Page2. The problem is that you cannot sporadically (or
asynchronously) add history points, so even if I had the ability to
retrieve the history from data popped from the stack, I can't add the
history points.

Is there a way to prevent the loss of the previous page's history
points?

TIA,

JT
 
Ad

Advertisements

A

Alvin Bruney - ASP.NET MVP

I don't exactly understand what you mean by sporadically and
asynchronously. In the latter case, all async operations start somewhere.
And that somewhere is where you add the history point. I'm not sure what you
mean by sporadically. Bare in mind that ajax history is not enterprise ready
in my tried opinion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top