jac
jac

Reputation: 9726

Reconnect to ASP.NET Session

I have an ASP.NET page that gathers some user information, then sends a post including a url to a third-party web site for processing. After processing the third party web site sends a post back to the url included in the original post. The problem is when the new page receives the post message the SessionID is different and the user information is not in the new session. If I store the original SessionID can I use it to connect to the original session?

Upvotes: 0

Views: 632

Answers (2)

user3189157
user3189157

Reputation:

I've ran into situations like this before, I used a few different solutions.

Then, you can get the value(s) back from the database that you put in there before third-party redirect.

  • Second approach is to write needed data into cache before redirect. Since you can set the life of the data to be short, this can be a neat solution and you do not expose any information via URL. Just be careful to identify the user if necessary.

Upvotes: 1

Nico
Nico

Reputation: 12683

The quick answer is no. You cannot reuse an existing session. The purpose of the session is to be unique to each visitor across multiple platforms (and browsers).

If I understand correctly the third party site is post asyncronously back to the URL specified. If this is the case then the third part request is being assigned a new session ID as it is a new session to your web application. I would suggest modifying your call back URL to post back some information that then allows you to locate the user information that was originally sent over. This can be done by just providing a querystring key that denotes the user ID, or more advanced point to a key in your web storage system to locate more details on the original request. Such as http://www.mysite.com/myThirdPartyCallBack?userID=abcd12345

On the other hand, if the following processes is happening. User posts a form to a third party site. Then the user completes some work on the third party site and is then redirected back to your site then this is more of a session timing issue. If this is the case then I would inspect your session timings to ensure they are long enough for user to complete the work on the third party site.

Just and idea.

Upvotes: 0

Related Questions