Latest web development tutorials

WebSecurity Logout method

WebSecurity objects WebSecurity objects

definition

Logout () method off the current user.


C # and VB syntax

Logout ()


Examples

Examples of C #

// sign out
WebSecurity.Logout ();

// Jump Back Home
Response.Redirect ( "~ /");

Examples VB

' sign out
WebSecurity.Logout ()

'Go back to the home page
Response.Redirect ( "~ /")


parameter

no.


return value

no.


Errors and exceptions

In the following scenario, any access to WebSecurity object will throw an InvalidOperationException:

  • InitializeDatabaseConnection () method has not been called
  • SimpleMembership not initialized (or disabled in the site configuration)

Remark

When the user has logged in, set up a ASP.NET authentication token in a cookie, so that ASP.NET knows subsequent requests the user has logged on.

Logout () method to remove an authentication token, logoff users.


Technical data

名称
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll


WebSecurity objects WebSecurity objects