Page context

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to maintain page context between pages.

Search -> Edit -> back to Search w/last search there and some variants

The thing is I also want people to be able to hit Control+N for a new window and get a new search. I'd also like to be able to use the foward and backward navigation. So far I've been able to do the following:
I can create a function key, pass it on the URL, pick up the values from the url, send a form back that auto submits with the URL rewritten and context on the form or a variant of this. This has the side effect of no navigation...
or
I can create a function key, pass it on the URL, pick up the values from the url and use those. This has the side effect of if I hit control+N the new window is using the current windows context. Which can be really bad in some cases...

Both to work to a point. Is there a .net way to do this? I seem to be a bit thick headed this morning.

Thanks,

Larry
 
Larry Charlton said:
I want to maintain page context between pages.

Search -> Edit -> back to Search w/last search there and some variants

The thing is I also want people to be able to hit Control+N for a new
window and get a new search. I'd also like to be able to use the foward and
backward navigation. So far I've been able to do the following:
I can create a function key, pass it on the URL, pick up the values from
the url, send a form back that auto submits with the URL rewritten and
context on the form or a variant of this. This has the side effect of no
navigation...
or
I can create a function key, pass it on the URL, pick up the values from
the url and use those. This has the side effect of if I hit control+N the
new window is using the current windows context. Which can be really bad in
some cases...
Both to work to a point. Is there a .net way to do this? I seem to be a
bit thick headed this morning.

You can save the search criteria in Session variables. They will still be
there when you get back to the Search page.
 
Jerry Pisk said:
Or not, if you ran another search in a second window on the same session.

If the goal is to keep the "latest search", then this is exactly what you
would want.
 
My problem is simpler and harder than that. The "if you ran the search in a second window..." is correct. Basically what I want to track is one piece of information. A number would work. I have to put that number on the page (in the form). When I leave the page for another, that second page needs to know what the number is. When it returns to the first page that number needs to get passed back so it can get it's context. The number can't be in the URL, or if it is, has to be removed immediately.

Consider pressing Control+N, I have two different contexts that need to be returned to. Something like the following:
search(5) -> Control+N -> search(6)
Now I have two searches with different contexts and the following might happen:
search(5) -> Edit(7) -> search(5)
search(6) -> Edit(8) -> search(6)

What I'm trying to figure out is how to get 5 from search to edit and then back again. If I put 5 in the URL, when I press Control+N I get 2 5's.

Also consider a web farm. If I use session, I'm going to have to move storage off to another server and slow every page down for that server.
 
Larry Charlton said:
My problem is simpler and harder than that. The "if you ran the search in
a second window..." is correct. Basically what I want to track is one piece
of information. A number would work. I have to put that number on the page
(in the form). When I leave the page for another, that second page needs to
know what the number is. When it returns to the first page that number
needs to get passed back so it can get it's context. The number can't be in
the URL, or if it is, has to be removed immediately.
Consider pressing Control+N, I have two different contexts that need to be
returned to. Something like the following:
search(5) -> Control+N -> search(6)
Now I have two searches with different contexts and the following might happen:
search(5) -> Edit(7) -> search(5)
search(6) -> Edit(8) -> search(6)

What I'm trying to figure out is how to get 5 from search to edit and then
back again. If I put 5 in the URL, when I press Control+N I get 2 5's.
Also consider a web farm. If I use session, I'm going to have to move
storage off to another server and slow every page down for that server.

Ok. If you need to associate something with a particular browser window,
then you're pretty much stuck using either the URL or a form field. You may
use a hidden form field. You can also use Server.Transfer to transfer
between the search and Edit pages. The Edit page may use the Context.Handler
property to get access to the members of the search page. This would include
the saved number.

I could give you more detail and maybe a sample, but I need to know when the
number is determined, and whether it depends on the search criteria the user
enters on the search page.
 
Currently I do something like the following:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
fk = "" & Request.QueryString("fk")
if fk<>"" Then
Regen=true
Else
fk = "" & Request.Form("fk")
end if
if fk="" Then
fk = New FunctionKey
end if
If Regen
Get page minus any fk parameters, this is the url that the following will submit to
Write a page that submits itself back onload="submit();"... that has fk as a hidden field
end if

Does that make sense? Basically I generate an fk if I'm in the page and I don't have an fk. if I have one in the URL I have to rewrite the URL without it, but to work well in a server farm I could only think of putting the fk field on a form. Also the only way I'm going to get to this page with fk on a form is if another page created an auto-submit form that submitted (redirected) to this page. Either way I've got that autosubmit form. Pressing back hits one of these two pages and redirects us back where we currently are. Also if there is a way to prevent those little resubmit pages from hitting the history that would be cool, but seems unsafe...

Basically what I'm hoping for is something like the following. I create a key that points to the status of say a search page. I'd like the search page to "call" the edit page and have the edit page remember that it was called from the search page and the search pages key. When I exit the edit page, if it was called it passes the remembered search key back to the search page and it can blissfully re-render itself with that key.

I'd also like to be able to write a function on one web server that "calls" a function on another web-server and have it be able to return. (because it knows the page that called it and the key that page needs).

While trying to code this I assume that every server request is hitting a different server. (Might be overkill)
 
Back
Top