Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regenerate SessionID in ASP.NET

Tags:

c#

asp.net

Please suggest how to regenerate a new Session ID in ASP.NET. If we are using SessionManager to generate a new id then it doesn't change the value of Session.SessionID. Please suggest how this can be achieved. Basically I want to have a new Session.SessionID after abandoning Session or generating NewID with SessionManager.

Thanks

like image 477
user686021 Avatar asked Mar 31 '11 15:03

user686021


1 Answers

Take a look onto SessionIDManager.SaveSessionID method, it saves a newly created session identifier to the HTTP response.:

SessionIDManager manager = new SessionIDManager();
var newId = manager.CreateSessionID(Context);
var isRedirected = false;
var isAdded = false;
manager.SaveSessionID(Current, newId, out isRedirected, out isAdded);
like image 132
Oleks Avatar answered Oct 02 '22 21:10

Oleks