WebSecurity.Logout Method

Logs the user out.

Namespace:  WebMatrix.WebData
Assembly:  WebMatrix.WebData (in WebMatrix.WebData.dll)

public static void Logout()


The SimpleMembershipProvider.Initialize(String, NameValueCollection) method was not called.


The InitializeDatabaseConnection() method was not called.


The SimpleMembershipProvider membership provider is not registered in the configuration of your site. For more information, contact your site's system administrator.

This method removes the authentication token, which has the effect of logging the user out.

For an example of how to use of the Logout() method, see the Logout.cshtml file in the Starter Site template.

  • Medium trust for the immediate caller. This member can be used by partially trusted code.