Grounding.co.za

Technology information for IT specialists
Welcome to Grounding.co.za Sign in | Join | Help
in Search

Tech Talk with Brett Maytom

Logging a user out with forms authentication in ASP.NET

This weekend I was doing some work on my pet little portal project and needed to create a logout link where the user can logout or sign-out.  The membership interface did not have any logout method and abandoning the session did not help either.  Although the LoginStatus control did log the user out, I needed to do this programmatically and not through the UI.

I searched the web with many different keywords hoping to find an answer but with no avail.  I knew it could be done as other products have the feature so I jumped into MSDN to find the answer, after a few hours of my life I found one line of code that does it:

FormsAuthentication.SignOut();
The System.Web.Security.FormsAuthentication class can be really useful when customising and controlling authentication.
Published Nov 11 2007, 12:27 AM by Brett
Filed under:

Comments

No Comments

About Brett

Brett Maytom is a MCSE+I, MCSD, MCDBA, CCNA, CNE and MCT. Brett’s core industry focus is enterprise architecture. The technologies Brett focuses on is Microsoft .NET, C#, SQL Server, BizTalk and SharePoint development
Add to Technorati Favorites
Powered by Community Server (Commercial Edition), by Telligent Systems
Afrigator