• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 571
  • Last Modified:

ASP.Net Login/Logout with Forms Authentication issue

I am using Forms Authentication with an ASP.Net website (C#, Visual Studio 2008). If I bring the browser up and login I can get in. When I click the Logout link it goes to the correct page, but if I then try to login again as a different user, I am logged in as the previous user. It seems to be storing the user info and continuing to use it. The only way to log in as a different user is to close the browser and open it again. Any idea how to fix this issue?
0
dodgerfan
Asked:
dodgerfan
  • 2
  • 2
2 Solutions
 
Bill NolanCommented:
Are doing something unusual?  E.g.:

1) Are your login controls in an UpdatePanel?
2) Have you disabled ViewState?
3) Have you messed with the browser cookies?
0
 
Alfred A.Commented:
Try putting the following in your logout link event:

Session.Abandon();
0
 
Bill NolanCommented:
You may also need this in the chain:

FormsAuthentication.SignOut();

...however, I don't think omitting this should cause the behavior you describe.
0
 
dodgerfanAuthor Commented:
All of the comments had me working through the code to get it working. I was looking in the wrong section. Some redundant stuff I thought I had removed. Once the logout page was redirected to properly, it worked correctly. The On_load event of the logout page runs the Forms.Autrhentication.SignOut(), plus I put session.abandon in it and finishing it by re-directing back to my main page with the user logged out. I've tested it repeatedly and it's working right. Thanks for all of the ideas, they all got me looking in the right area. I'm going to try and divide up the points.
0
 
dodgerfanAuthor Commented:
All of these comments/suggestions helped me find the solution.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now