- UserName as CCharacter
The name of the user.
The password for the user.
The page the user will be redirected to on successful login. If not specified the application defined redirect page will be used.
Set to .T. to create a persistent cookie. This type of cookie will remain across browser sessions. That is, if you close your browser and restart the cookie will be available. When set to .F. the cookie will not be available across browser sessions. The cookie is deleted when close your browser. This is the default and is a more secure setting.
The number of days the authentication cookie is valid. This is calculated from the time of the last request made with the cookie.
Returns .T. if the user is logged in; otherwise .F.
Logs in a user to a specific page and sets the authentication cookie's lifetime.
Context.Security.Login() logs in a user and optionally letting you redirect the successful login to a specific page and set the authentication cookie's lifetime. When login is successful the Context.Security.CallResult.ReturnDataValue will contain the redirect page URL. Check Context.Security.CallResult.Success before using the return value.
Example: Redirecting After Login
Upon successful login, the user can be redirected to another page. The Context.Security.CallResult object has a property called ReturnDataValue that contains the page to redirect the user after login. This property will either contain the default redirect page defined in security settings or contain the redirect page specified when the login method was called. If login fails or the redirect behavior is set to "current page", Context.Security.CallResult.ReturnDataValue will be blank.
The example below demonstrates how to peform a redirect using Context.Security.CallResult.ReturnDataValue:
context.Security.Login(Username,password,"index.a5w") if context.Security.CallResult.Success if Context.Security.CallResult.ReturnDataValue <> "" ' has a redirect response.redirect(Context.Security.CallResult.ReturnDataValue) end if end if