How to force a New Session and SessionID

G

Guest

I have an app that uses the sessionID to track user navigation and usage
through the application.

It works fine except in one case:
There is a point in the application where I want to "close" the user's
tracking and handle the user as if he had just logged on. To do that, I need
a new sessionID. But even if I call Session.Abandon(), the user's SessionID
does not change -- it just dumps session values.

How can I force a new sessionID at some point in the application? Or must I
think of a different way of creating an ID to track the user in the
application?

Thanks
 
M

Marina

I am assuming you are using the SessionID to track something else. In this
case, use another ID created by you, and store that as a session variable.
When you abandon the session, this session variable will be gone, and you
will need to create another one. Now you have a new unique ID to use.
 
M

Mythran

Hardin said:
I have an app that uses the sessionID to track user navigation and usage
through the application.

It works fine except in one case:
There is a point in the application where I want to "close" the user's
tracking and handle the user as if he had just logged on. To do that, I
need
a new sessionID. But even if I call Session.Abandon(), the user's
SessionID
does not change -- it just dumps session values.

How can I force a new sessionID at some point in the application? Or must
I
think of a different way of creating an ID to track the user in the
application?

Thanks

If I remember correctly, the Session.Abandon method does indeed work
correctly, but not as you would think it would. When you call
Session.Abandon, it will abandon the Session as soon as the current request
is completed. So, something like the following snippet should help:

Session.Abandon()
Response.Redirect(Request.Path) ' Can't remember exact property of Request
to get the current file's path.


HTH,
Mythran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top