Programmatic logout
On my custom login form, how do I programmatically execute the same behavior that the built-in login form performs with the button "Log the other user off and enter"?
Thanks,
Matt
Hi Matt,
This is how you logout the currently logged user. The user login information is kept in cookie and when deleted the current user is anonymous.
SecurityManager.Logout();
SecurityManager.DeleteAuthCookies();
I'm trying to log the user out of another machine. I'm looking at the login form trying to login, so there is no current user session or cookies yet. I do have the credentials, however, because I just tried to login. This method partially works:
SecurityManager.Logout(credentials);
Hi Matt,
The exact code is:
SecurityManager.BuildLogoutCookie(UserLoggingReason.UserLoggedOff, SystemManager.CurrentHttpContext);
SecurityManager.Logout();
SecurityManager.Logout();
SecurityManager.DeleteAuthCookies();
For Sitefinity 10 and up, all this doesn't seem to be relevant anymore.
Please see this KB article (posted 19-4-2017)
knowledgebase.progress.com/.../cannot-log-out-using-the-api-after-upgrade-to-sitefinity-10