You need to sign in to do that
Don't have an account?
![SriniK SriniK](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
API Call login question
Hi
We are using API call in our integration application which is in .net. Is there any specific error code or message which specifically states that error was due to invalid username and or password. Based on which next steps would be taken like telling the user to re-enter his credentials.
Thanks
Srinik
Public Function loginSalesForceServer(ByVal UserName As String, ByVal Password As String) As Boolean
Dim loginRes As sforce.LoginResult
Dim un As String = UserName
If un.Length = 0 Then
Return False
End If
Dim pw As String = Password
If pw.Length = 0 Then
Return False
End If
'/*
'* Create the sfbinding to the sforce servics
'*/
sfbinding = New sforce.SforceService
'// Time out after a minute
sfbinding.Timeout = 60000
Try
loginRes = sfbinding.login(un, pw)
Catch e As System.Web.Services.Protocols.SoapException
'// This is likley to be caused by bad username or password
Return False
Catch ex As System.Exception
'// This is something else, probably comminication
Return False
End Try
sfSessionID = loginRes.sessionId
sfServerURL = loginRes.serverUrl
'//Change the sfbinding to the new endpoint
sfbinding.Url = loginRes.serverUrl
'//Create a new session header object and set the session id to that returned by the login
sfbinding.SessionHeaderValue = New sforce.SessionHeader
sfbinding.SessionHeaderValue.sessionId = loginRes.sessionId
prvSalesForceLoginState = "Logged In"
Return True
End Function
Thanks Pat for your time and effort..
Srinik