Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Hi,
There are a couple of different methods available for authentication in .NET, where the most popular kind is FormsAuthentication. It enables use of regular textboxes on a web page to be used as the login form, and uses cookies to store authentication data. I will assume that you are using FormsAuthentication.
There are (at least) two options. The first involves using the LoginStatus class in System.Web.UI.WebControls: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.loginstatus(VS.85).aspx
The control detects the user's authentication state and toggles the state of a link to log in or log out of a web site.
Behind the scenes, the LoginStatus control calls FormsAuthentication.SignOut(), which removes the authentication data from the cookie mentioned above. See MSDN on this method here: http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.signout.aspx
Regards,
Kristoffer Sjöberg
EPiServer AB
Hi,
Also worth mentioning is the OnlineStatus-module in EPiServer Community that keeps track of which users are actually logged in to the community. You can set a user to appear offline by calling:
StarCommunity.Modules.OnlineStatus.OnlineStatusModule.LogOffUser(IUser user);
Otherwise the user will automatically appear offline after 20 minutes of inactivity.
Regards,
Mattias Nordberg
Hi,
The first option to use a webcontrol tp toggle log in and log out behavior is not exactly what I need, The user logs in on one webpage and loggs off on another.
Using LogOffUser seems more like it. But, when I type in StarCommunity.Modules. in VS the only thing to choose next is Forum. Am I missing an assembly or how can I find LogOffUser?
regards
Madelene
Hi,
You should add the references you need to your project, they are located in the web application's "bin" directory after installation. For the OnlineStatus-module you will need to add StarCommunity.Modules.OnlineStatus.dll.
Regards,
Mattias
Hi,
I found LogOffUser by adding a reference to the dll you mentioned. Thank you.
To do the actual log off I use FormsAuthentication.SignOut();
regards
Madelene
Once a user has logged in to EPiServer Community, how do I logg this user off?