WebSecurity.Login(String, String, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.