简体   繁体   中英

Sign out in Classic ASP when using forms authentication

I am working on an application that was originally written in Classic ASP and am converting that application to ASP.NET MVC. the users switch between the two sections of the application depending upon what has been converted and what is pending.

Here is my question: I have just implemented forms authentication using the membership provider in .Net. I want to know how will I sign out a user from the classic asp side? should I simply redirect a user to a controller action in MVC to call the FormsAuthentication.SignOut() and Session.Abandon() methods, or is there a way to sign out a logged in user in Classic ASP?

Any help will be appreciated.

There is no 'standard' in classic ASP for designating whether a user is logged-in or not, but in most systems there will usually be some sort of session variable set (ie session("loggedin") or session("userID"), etc.). So you could do a Session.Abandon() but that may have the undesirable effect of losing other, non-login related session variables. Instead, determine which session variables indicate that a user is logged-in (on the classic ASP side) and remove them from the collection, eg:

session.contents.remove("loggedin")
session.contents.remove("userID")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM