You need to sign in to do that
Don't have an account?
Trouble checking session ID for subsequent calls
public bool loginCheck()
{
sfbinding.SessionHeaderValue = new SessionHeader();
string sId = sfbinding.SessionHeaderValue.sessionId;
if (sId == "")
return login();
else
return true;
}
If I call loginCheck() directly from a script, I get the desired result (always returns true because if the session ID is empty, then the login function is invoked). However, if I call it from within another function, for example:
public string testFunction()
{
if ( loginCheck() )
{
...
}
}
Then I get the error "UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService". Can someone please help me understand why this is?
Thank you.
sfbinding.SessionHeaderValue = new SessionHeader();
every time, this is still not going to do what you want, as it'll do a login every single time because you're clearing out the session header.
Thanks Simon.
However, because I originally call [sfbinding.SessionHeaderValue = new SessionHeader();] within the login() function, if I try to remove that line from loginCheck() then I get this error:
Object reference not set to an instance of an object.
Every piece of sample code for logging in invokes [sfbinding.SessionHeaderValue = new SessionHeader();] within the login() function. So...to my original question, if the SessionHeader is not set in the first place, how do I check if I need to do a login or not?
In other words, how have other people implemented a check to see if there is a need to perform a login?
Message Edited by margotq on 11-13-2006 05:59 PM