LoginWithCredentials()

Top  Previous  Next

The LoginWithCredentials() method is a high level function for authenticating in a web forms environment.  Credentials are validated with GetLoginKey().  If the credentials were valid, a LoginKey is generated and stored in a Session variable along with the company's setup record.  The LoginWithCredentials method is typcially used in the initial login screen.  The CheckCredentials() method is then typically used to validate the login on each screen (in Page_Load) for the duration of the session.

 

LoginWithCredentials() performs the following operations:

 

1. Checks for a valid login credentials, in the following order:

1.Checks for URL credentials.
2.Checks for URL LoginKey.
3.Checks for a LoginKey in Session.
4.Checks AutoLogin (only if no URL credentials or LoginKey are found, and if "AutoLoginCompanyID" = "1" in Web.Config)

 

2. Calls VerifyUserAccessRights() to verify that the user has access to the screen.

 

3. Load the User Access records for the current user in to the Cache.

 

Example

 

If Not WebLedgerLib.LoginWithCredentials(Page, "Demo", Demo", "Demo", "", errNbr, errMsg)

 

       Response.Write(errMsg)

       

       Exit Sub

 

End If

 

See: How to Login, LoginKeys