How to Login

Top  Previous  Next

Use GetLoginKey() or LoginWithCredentials() to authenticate user credentials and login to the ObjAcct Framework.  Use SetCredentials() or PopulateObjAcctSoapHeader() to pass credentitals in the SOAP Header of each call.

 

The following code performs a login by calling the GetLoginKey() function using existing user credentials and then stores the LoginKey that is returned in Session.

 

Visual Basic

 

' Get an instance of the LoginWebService.

Dim ws As New WebServices.LoginWebService()

 

Dim ds As DataSet

 

' Get a loginKey from the web service.

ds = ws.GetLoginKey("demo", "smith", "abc123", _ 

"", "", "", "", "", "", ReturnType.Standard)

 

' Check for errors and invalid logins.

If StdLib.GetErrorNumber(ds) < 0 Then

    Response.Write(StdLib.GetErrorMessage(ds))

Else

    ' Store the LoginKey in Session (or ViewState).

    Session("LoginKey") = ds.Tables("Login").Rows(0).Item("LoginKey")

End If

 

C#

 

ObjAcct.Framework.WebServices.LoginWebService wsLogin = new ObjAcct.Framework.WebServices.LoginWebService();

 

DataSet ds;

 

ds = wsLogin.GetLoginKey("demo""demo""demo""""""""""""""0");

 

if(ObjAcct.Framework.StdLib.GetErrorNumber(ref ds) < 0)

 

{

       Response.write(ObjAcct.Framework.StdLib.GetErrorMessage(ref ds));

}

 

See: SetCredentials(), Using Autologin in Web.Config