views:

79

answers:

2

I'm building a payment page in asp.net, however the page where you order your items is run in HTTP (non-secure) on my domain.

When redirecting the user to the payment site, I have to go through a different domain (my payment provider, from whom I borrow the SSL certificate), so my payment url ends up like https://www.paymentprovider.com/somescript.cgi/www.mydomain.com/mypaymentpage.aspx

Now the problem is my session is lost, but I store the order in session, so I desperately needs it.

Can I somehow send the SessionID in querystring, and restore the session from it - or do I need to stuff the entire order into querystring ? (Not too certain it'll fit though, it's rather long)

Any help will be highly appreciated :-)

A: 

Why don't you load the Session into a Cookie right before redirecting, and when the user reaches your payment area, re-create the session from that cookie?

TheGeekYouNeed
that would be more than unsafe
Tim Mahy
And doesn't work because the cookie isn't available as I'm on a different domain.
Steffen
+1  A: 

Steffen

the correct way is to use a unique orderId that you send with the payment, and then the payment gateway its send it back to you.

Its not so simple as its sounds because for security you need ether to encrypt the orderID, and send it and get it encrypted, or else everyone can see and change your orders, ether communicate with the payment gateway with some kind of encrypted protocol.

Paypal do this way, with your order you need to send to paypal a unique ID that you can use it only one time for one transaction, and then paypal make the reference base on this ID.

The other way you say with the session and the cookie is not safe and both can expires, lost, what ever. The session is saved on a cookie anyway. Longer time on session can make what you all ready have to work - but its unsafe and randomly to what ever happens to session or the cookie.

Aristos
The problem is the order isn't stored in a database, but I guess I have to change that, so I can use the OrderID approach. Thanks for the comment.
Steffen
@Steffen yes you absolute must fix a way to store a unique orderID even if order left open - and every new order must get a new unique orderID, and this is what you pass with this order on every state across your pages.
Aristos
I've got it running now. I create every order in the database, and use a guid for my querystring upon passing between domains.I use a guid so people can't just plot in 1,2,3 etc. to view other people's orders.I realize this isn't perfect, but when I'm stuck with querystring, it's pretty much the best I can get.Thanks again for your advice :-)
Steffen