Last post May 09, 2014 03:08 AM by Blind-Striker
Apr 29, 2014 05:55 AM|Blind-Striker|LINK
I know we can change Session ID Manager via webconfig like ;
<sessionState sessionIDManagerType="SampleSessionIDManager" />
Is it possible to change Session ID Manager using PreApplicationStartMethod? Or is there any way to change programmatically.
Apr 29, 2014 09:38 PM|Terry Guo - MSFT|LINK
Welcome to ASP.NET forum.
If you want to change sessionid programmatically, please try to refer to the following code:
SessionIDManager Manager = new SessionIDManager();
string NewID = Manager.CreateSessionID(Context);
string OldID = Context.Session.SessionID;
bool redirected = false;
bool IsAdded = false;
Manager.SaveSessionID(Context, NewID, out redirected, out IsAdded); Response.Write("Old SessionId Is : " + OldID);
Response.Write("<br/> New Session ID Is : " + NewID);
Response.Write("<br/> Session Id did not saved : ");
Hope it helps.
May 09, 2014 03:08 AM|Blind-Striker|LINK
Thank you for your answer. But I don't want to change Session Id, i want to change Session ID Manager. I already inherit and override SessionIDManager class.
And configure like
<sessionState sessionIDManagerType="MySessionIDManager" />
Here is the msdn link about changing SessionIDManager via web config
But what i want is changing SessionIDManager programmatically. My guess is its must be some way on PreApplicationStartMethod.