atamata
atamata

Reputation: 1077

Delete HttpContext.Current.Session on the fly

I have code which stores user details in HttpContext.Current.Session for auditing purposes.

I'm wanting to test exception handling for when the session expires, is there a way of clearing the session variables in HttpContext.Current.Session from Internet explorer developer toolbar so that I don't have to wait for it to expire?

thanks

Upvotes: 0

Views: 1825

Answers (2)

Gagan Deep
Gagan Deep

Reputation: 1509

Try Clearing Cookies. that should clear your ASP Session Cookies as well and your server wont recognise that the request is coming from the same session.

Upvotes: 1

VDWWD
VDWWD

Reputation: 35564

You can use

Session.Remove(SessionName);
//or
Session.RemoveAll();
//or
Session.Clear();
//or
Session.Abandon();

More info here for details on the differences: https://msdn.microsoft.com/en-us/library/ms524319(v=vs.90).aspx

Upvotes: 0

Related Questions