Logout and go to Login Form
I have two pages, called Login and Start.
Page Login contains a Login control. In the Login control, the property DestinationPageUrl is set to "/Test/Start".
This works great - the user logs in and is taken to the Start page.
I've put a Login Status control on the Start page.
What I would like, is for the user to log out and then be taken back to the Login page.
What property do I change for that and what do I put into the property?
Thanks.
Matt.
Hi Matt,
You have to use LogoutAction
The LogoutAction is a property that comes from the base class of LoginStatus control Here are the modes that the property accepts.
Redirects the user to the URL contained in the LogoutPageUrl property. If LogoutPageUrl is empty, the user is redirected to the login page defined in the application configuration settings. |
|
Redirects the user to the login page defined in the application configuration settings. |
|
Refreshes the current page. |
Thanks Ivan.
i try adding the property you say, but it doesn't runs....
any suggestion?
Hi,
If you use the latest internal build from the last Friday there should not be a problem. The issue was fixed there.
Regards,
Ivan Dimitrov
the Telerik team
Hello,
We are having a problem with the Logout widget. It does not logout the user. When user is logged on and then they logout, their ID persists; so that when a user with a new set of credentials logs in, somehow, Sitefinity still thinks that the old user is still logged in. We added a LogoutAction URL Redirect, which is just an aspx page where we try to force the logout, using the lines of code below:
Telerik.Sitefinity.Security.SecurityManager.Logout();
Telerik.Sitefinity.Security.SecurityManager.DeleteAuthCookies();
This does not work.
When I Query the Telerik.Sitefinity.Security.SecurityManager.GetCurrentUserName, it is set to anonymous, but when a new user logs in this has the value of the user that was previously logged in.
Can you please point us in the correct direction?
Hello Eric,
What version of Sitefinity are you using? Please try the following in the meantime:
// Log out the specified user
User alreadyLoggedInUser = userManager.GetUser("userName");
SecurityManager.Logout("Default", alreadyLoggedInUser.Id);
alreadyLoggedInUser.IsLoggedIn = false;
userManager.SaveChanges();