WebSecurity.Login(String, String, Boolean) Method

Definition

Logs the user in.

public static bool Login (string userName, string password, bool persistCookie = false);
static member Login : string * string * bool -> bool
Public Shared Function Login (userName As String, password As String, Optional persistCookie As Boolean = false) As Boolean

Parameters

userName
String

The user name.

password
String

The password.

persistCookie
Boolean

(Optional) true to specify that the authentication token in the cookie should be persisted beyond the current session; otherwise false. The default is false.

Returns

true if the user was logged in; otherwise, false.

Exceptions

The Initialize(String, NameValueCollection) method was not called.-or-The InitializeDatabaseConnection method was not called.-or-The SimpleMembershipProvider membership provider is not registered in the configuration of your site. For more information, contact your site's system administrator.

Applies to