By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,696 Members | 2,256 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,696 IT Pros & Developers. It's quick & easy.

Is there a way to send info to another page without posting or using querystring?

P: n/a
Hello,

I have a page where users can alter the contents of a shopping basket.
Once they are happy with the contents, they click a "checkout" button
and are taken to the checkout page.

What actually happens is that the "checkout" button causes a normal
postback, where some work is done before redirecting them to the
checkout page. I need to pass the basket ID to the checkout page, but
don't want to put it in the querystring as I don't want the user seeing
it. I can't (AFAIK) post to the checkout page as I'm doing this from the
code behind the basket page.

Any suggestions how I get the basket ID across without the user seeing
it? I thought about creating a session variable, then doing a
Response.Redirect and picking up the session variable in the checkout
page. That page would empty the session variable once it has been read.
This would probably work, but seems messy. Anyone got a neater solution?

TIA

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
pass it to a DB and reread it in on the next page...but again you would need
an unique ID to differentiate the user. The session (or cookie) storage of
the id is probably your best bet....

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Alan Silver" wrote:
Hello,

I have a page where users can alter the contents of a shopping basket.
Once they are happy with the contents, they click a "checkout" button
and are taken to the checkout page.

What actually happens is that the "checkout" button causes a normal
postback, where some work is done before redirecting them to the
checkout page. I need to pass the basket ID to the checkout page, but
don't want to put it in the querystring as I don't want the user seeing
it. I can't (AFAIK) post to the checkout page as I'm doing this from the
code behind the basket page.

Any suggestions how I get the basket ID across without the user seeing
it? I thought about creating a session variable, then doing a
Response.Redirect and picking up the session variable in the checkout
page. That page would empty the session variable once it has been read.
This would probably work, but seems messy. Anyone got a neater solution?

TIA

--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #2

P: n/a
You could set a cookie. I personally like session and would choose that over
using a cookie, however.
"Alan Silver" wrote:
Hello,

I have a page where users can alter the contents of a shopping basket.
Once they are happy with the contents, they click a "checkout" button
and are taken to the checkout page.

What actually happens is that the "checkout" button causes a normal
postback, where some work is done before redirecting them to the
checkout page. I need to pass the basket ID to the checkout page, but
don't want to put it in the querystring as I don't want the user seeing
it. I can't (AFAIK) post to the checkout page as I'm doing this from the
code behind the basket page.

Any suggestions how I get the basket ID across without the user seeing
it? I thought about creating a session variable, then doing a
Response.Redirect and picking up the session variable in the checkout
page. That page would empty the session variable once it has been read.
This would probably work, but seems messy. Anyone got a neater solution?

TIA

--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #3

P: n/a
Alan,

You could use Server.Transfer and pass the id to the new page in the context
object of the page.

Page1:

Context.Items.Add("BasketId", Value)
Server.Transfer("Page2.aspx")

Page2:

Dim BasketId As Int32 = Ctype(Context.Items.Item("BasketId"), Int32)

The only thing is that Server.Transfer bypasses the client so the client
will still have page1's web address in the address bar when the client shows
up on the checkout page. But that shouldn't matter...

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Alan Silver" <al*********@nospam.thanx> wrote in message
news:eJ**************@nospamthankyou.spam...
Hello,

I have a page where users can alter the contents of a shopping basket.
Once they are happy with the contents, they click a "checkout" button and
are taken to the checkout page.

What actually happens is that the "checkout" button causes a normal
postback, where some work is done before redirecting them to the checkout
page. I need to pass the basket ID to the checkout page, but don't want to
put it in the querystring as I don't want the user seeing it. I can't
(AFAIK) post to the checkout page as I'm doing this from the code behind
the basket page.

Any suggestions how I get the basket ID across without the user seeing it?
I thought about creating a session variable, then doing a
Response.Redirect and picking up the session variable in the checkout
page. That page would empty the session variable once it has been read.
This would probably work, but seems messy. Anyone got a neater solution?

TIA

--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #4

P: n/a
Thanks to all of you for your replies. I just realised that using a
cookie or session variable is going to be a problem as I will be
redirecting to a page on another server (a secure one, unlike the main
site), so cookies and session variables will not be shared.

I have previously fiddled my way around this by including a dummy <img>
tag on the page, with the src of the image being set to a dynamic page
on the other server. That page sets a cookie and then returns some dummy
image. This is a trick to set a cookie on another server. I may try that
here.

As for the idea below, it looks clever, but I had a lot of problems
getting it to work neatly. I think I will try the above idea first and
see how that works.

Thanks again to all of you.
You could use Server.Transfer and pass the id to the new page in the context
object of the page.

Page1:

Context.Items.Add("BasketId", Value)
Server.Transfer("Page2.aspx")

Page2:

Dim BasketId As Int32 = Ctype(Context.Items.Item("BasketId"), Int32)

The only thing is that Server.Transfer bypasses the client so the client
will still have page1's web address in the address bar when the client shows
up on the checkout page. But that shouldn't matter...


--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #5

P: n/a
Alan,

I wasn't aware that the new page was on a different site/server.
Server.Transfer only works within a single application.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Alan Silver" <al*********@nospam.thanx> wrote in message
news:n8**************@nospamthankyou.spam...
Thanks to all of you for your replies. I just realised that using a cookie
or session variable is going to be a problem as I will be redirecting to a
page on another server (a secure one, unlike the main site), so cookies
and session variables will not be shared.

I have previously fiddled my way around this by including a dummy <img>
tag on the page, with the src of the image being set to a dynamic page on
the other server. That page sets a cookie and then returns some dummy
image. This is a trick to set a cookie on another server. I may try that
here.

As for the idea below, it looks clever, but I had a lot of problems
getting it to work neatly. I think I will try the above idea first and see
how that works.

Thanks again to all of you.
You could use Server.Transfer and pass the id to the new page in the
context
object of the page.

Page1:

Context.Items.Add("BasketId", Value)
Server.Transfer("Page2.aspx")

Page2:

Dim BasketId As Int32 = Ctype(Context.Items.Item("BasketId"), Int32)

The only thing is that Server.Transfer bypasses the client so the client
will still have page1's web address in the address bar when the client
shows
up on the checkout page. But that shouldn't matter...


--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #6

P: n/a
>I wasn't aware that the new page was on a different site/server.
Server.Transfer only works within a single application.


Yup, my fault, I forgot to mention it. That's why I added the extra post
as it occurred to me that it would change things rather a lot.

I am currently thinking about having a page on the remote server that
takes the ID in the querystring, sets a cookie and immediately redirects
to another page on that server. The user would (hopefully) not see the
intermediate page, so the ID wouldn't be quite so obvious. I'm resigned
to the fact that it's very hard to hide it completely, but this may be
acceptable.

Thanks for the reply.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.