0

I have a problem with the login of a web page that I am working. when I log in the page, I save the information in the HttpRequest and HttpSessionState. But when I logoff and I create a new user for the page, this information is still stored in these parameters. How I can close a httpRequest and a HttpSessionState?

VVN
  • 1,607
  • 2
  • 16
  • 25

2 Answers2

0

You can close a HttpSessionState using the following:

https://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.clear(v=vs.110).aspx

And here is another stack question regarding the httpRequest

How to clear the cache of HttpWebRequest

Community
  • 1
  • 1
Mand
  • 499
  • 1
  • 5
  • 25
  • Thanks for your help. The clean method worked . But I don't understand something in the HttpRequest . HttpRequest is the same as the HttpWebRequest? – Jorge Filipe Pinto Mar 07 '16 at 14:48
0

Are you using Web Forms? What Authentication method are you using? Typically, in Web Forms, in the event handler for the Logout button, you would sign-out from Forms Authentication and the Session.

Session.RemoveAll();
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
Tamayi
  • 143
  • 4
  • Yes, I use the Form Autentication and I didn´t have insert the Session.RemoveAll(). But the Clean method also works. Thanks for yours help. – Jorge Filipe Pinto Mar 07 '16 at 14:44