The Login() method logs in a specified user, using a username and a password.
Parameter | Type | Description |
---|---|---|
userName | String | The user name |
password | String | The user password |
persistCookie | String | true to specify that the authentication token in the cookie should be persisted beyond the current session; otherwise false. Default is false. |
Type | Description |
---|---|
Boolean | true if the user is logged in, otherwise false |
When a user is logged in, ASP.NET sets an authentication token in a cookie that lets ASP.NET know on subsequent requests that the user has been logged in. If persistCookie is false, the token is valid only until the user closes the browser.
Any access to the WebSecurity object throws an InvalidOperationException if:
Name | Value |
---|---|
Namespace | WebMatrix.WebData |
Assembly | WebMatrix.WebData.dll |