WebSecurity.Login(String, String, Boolean) WebSecurity.Login(String, String, Boolean) 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 String String

The user name.

password
String String String

The password.

persistCookie
Boolean Boolean 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