Click here to Skip to main content
15,897,519 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Is there a way to clear in-memory cookie in current IE session (without restart IE) ?
the scenario like:
1. login a website (for example, code project www.codeproject.com)
2. Clear in-memory cookie for the login information.
3. press 'F5', the website get back to login page, or shows that user has signed out.
Posted

are you talking about asp.net login control's cookie? It stores an cookie named .ASPXAUTH. It holds a hash. If you modify the the hash from code behind after login (from example default.aspx code behind) like Response.Cookies[".ASPXAUTH"].value="xx" you are not logged any more. Can't refresh the page or ctrl+F5 , can't move to next page. All these make you not logged in.

The general way getting the cookies are like Request.Cookies["cookie name or index"].value (you need to check is the cookie exists before getting the value).

The way to write back the cookie is Response.cookies["name or index"].value="xxxxx"

But why you want to make the user logout after login?

Is that what you expected? otherwise I didn't understand your question.
 
Share this answer
 
What about this[^] link?


HTH
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900