469,934 Members | 1,581 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

ensure a parameter gets passed between pages

I'm trying to keep pages in sequence to make sure sessions don't
overlap if a user has 2 browsers running at the same time. The hitch
I'm coming across is when they change pages, either through post back
or an anchor.

I set up a HiddenField and check it when I enter and increment it when
I leave.

How could I go about injecting that field's value into the params when
I leave the page?

Sep 5 '07 #1
2 1130
I'm not exactly sure what you mean by "into the params". Do you mean
Request.Params (which combines querystring and forms elements)?

A lot of this really depends how the user is going to progress from one page
to the next - clicking a hyperlink (anchor as you called it), or posting a
form, or through something you do such as Server.Transfer or
Response.Redirect. You also have Cross-Page postbacks in ASP.NET 2.0 where
you can get a reference to the PreviousPage property of the Page class and
access your hidden field (if it is runat=server) from there.

Then you can add items to the querystring with javascript. So we may be
talking about a fairly complicated multi-faceted issue here.

It might be possible that you could just set a session variable and
increment it as each new page is reached, then check its value on the "next
page".
Peter
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"to*********@gmail.com" wrote:
I'm trying to keep pages in sequence to make sure sessions don't
overlap if a user has 2 browsers running at the same time. The hitch
I'm coming across is when they change pages, either through post back
or an anchor.

I set up a HiddenField and check it when I enter and increment it when
I leave.

How could I go about injecting that field's value into the params when
I leave the page?

Sep 5 '07 #2
Yes, I meant Request.Params.

well I'd hope I could avoid being to specific on how the user
programmer had to move between pages. I'm trying to make it
transparent. If its not transparent or minimal in impact it probably
won't be adopted.

My general goal here is to version my session so that if I open 2
windows of the same site they wont corrupt each other's session data.
So I don't think maintaining it in the session itself is will be
reliable. I'll try and think of a way to do that though.

Cross page postbacks took about 5 minutes to get working as expected,
thanks for that.

This seems like it would be very heavy for my purpose however. Really
what id like is this functionality for my one single HiddenField. I'm
doing a web app that has some rather idiotically large pages, so it
could be rather ugly. Redirect probably can be overridden to behave
consistently, but I'm skeptical of anchors which never even post
back. I could cycle through them with javascript I suppose, but that
sounds dirty.

This seems like it won't be functional enough for general consumption,
probably a dead end.

Sep 5 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Srini | last post: by
2 posts views Thread by Cole Shelton | last post: by
3 posts views Thread by Jeff | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.