In this article we will cover how to Reset or Generate new Asp.Net SessionID
To reset or change Asp.Net Session ID, will need to use SessionIDManager class
Create below mentioned function to save the new Session ID. This function will create a new Session ID and save it in Current Context
public void Reset_SessionID() { SessionIDManager manager = new SessionIDManager(); string newID = manager.CreateSessionID(Context); bool redirected = false; bool isAdded = false; manager.SaveSessionID(Context, newID, out redirected, out isAdded); }
Call above Function to create new Session ID
protected void Page_Load(object sender, EventArgs e) { string curSID= Session.SessionID; // SessionID when first time page load ResetSessionID(); }
Post Comments(0)