Reputation: 4207
Is there a way to refresh or regenerate the HttpContext.Session.SessionID
?
I am using this (browser) SessionID to follow a customer sign up of a certain product.
I use this ID to track their movement and errors and progression along the page.
After the user signs up, I want to refresh the session id, to let them theoretically sign up twice.
But i need the new ID to make it a new independent sign up.
Upvotes: 0
Views: 2639
Reputation: 253
you could use:
Session.Abandon();
Here is what I did and it produces a new session id:
protected void Page_Load(object sender, EventArgs e)
{
lblSession.Text = Session.SessionID;
}
protected void Button1_Click(object sender, EventArgs e)
{
Session.Abandon();
}
If you abandon the session, then the next page request will receive a new session id.
Upvotes: 2