function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ColdfingerColdfinger 

Classic ASP - webscript logon issues using Office Toolkit

 
I'm just looking at accessing the data on salesforce from our web site which is classic ASP,

The office toolkit has been installed on the web server, but whenever I try to make the login call, it returns false and does not create a valid session.

I have tried using two different username/password combinations, appending the security token to the end of the password and not, but whatever I do it gets to the "Login Failed" line below.  The office toolkit seems to be validly installed because it is not failing when the object is created.

Does anyone have any idea what I'm doing wrong?

Thanks in advance

 
<%@ Language="VBScript" %>
<%
dim g_sfApi
function login(username, password)
    set g_sfApi=Server.CreateObject("SForceOfficeToolkit3.SForceSession3.1")
    login=g_sfApi.Login(Username,Password)
end function
%>

<body>
<%
dim lr, sid, serverUrl, row, rc
dim qr' as QueryResultSet3
dim s' as SObject3
'lr = login(username, password1)
lr=login(username2,password2)
if not lr then
    Response.Write("Login Failed")
else
    set qr=g_sfApi.Query("select * from account",false)
 

...

gotherthanthougotherthanthou

Below is what I'm using successfully. 

 

Try declaring g_sfApi as SForceOfficeToolkitLib3.SForceSession3.

 

Perhaps it is because you have not assigned a return datatype to the login function.  It is probably returning a datatype of Variant, and I don't know if that will evaluate correctly in a test for true/false.

 

Public g_sfApi As SForceOfficeToolkitLib4.SForceSession4 Public Function LoginToSForce(strUserName As String, strPW As String) As Boolean Dim x As Variant Set g_sfApi = New SForceOfficeToolkitLib4.SForceSession4 x = g_sfApi.Login(strUserName, strPW) If (g_sfApi.Error = NO_SF_ERROR) Then LoginToSForce = True Else MsgBox g_sfApi.ErrorMessage LoginToSForce = False End If End Function

 

 

 

I make all calls through the public variable g_sfApi.

gotherthanthougotherthanthou
Also, if you're using VB from a site to create a webservice, you should probably be using the API, not the Office Tookit. 
SuperfellSuperfell
You should look at the error related properties on the g_sfApi object when the login fails. i think they're called errorNumber & errorMessage.
ColdfingerColdfinger

Thanks this is clarifying a bit where the problem is coming in:

 

Login Failed5103Unable to send request to server. A connection with the server could not be established 

 

Which sounds like the web server firewall is blocking access to the salesforce login.  I had a quick look through the office connector documentation, but I can't find mention of any firewall settings to be permitted for this operation.  Does anyone there have a reference I can use for this somewhere, or just know what I need to permit access for?

 

 

ColdfingerColdfinger

Further update, the firewall settings are all correct now,

 

but it now just freezes when the login call is made, and does not return :(