You need to sign in to do that
Don't have an account?
Invalid_Session_ID: Invalid Session ID found in SessionHeader
I think I'm on the right track to creating a lead but I get a "Invalid_Session_ID" error when I try to add the lead. Code is posted below. Am I missing something or what am I doing wrong?
private void createLead() {
//Create the proxy binding and login
sforce.SforceService binding = new sforce.SforceService();
try {
sforce.LoginResult lr = binding.login("login", "pwd");
Session.Add("sessionId", lr.sessionId);
Session.Add("url", lr.serverUrl);
Session.Add("userId", lr.userId);
sforce.Lead lead = new sforce.Lead();
}
catch (Exception ex) {
lblException.Text = ex.Message;
}
binding.Url = Session["url"].ToString();
// Create an account object to send to the service
Credco.Web.SignUp.sforce.Lead sfLead = new Credco.Web.SignUp.sforce.Lead();
// Set several properties
sfLead.FirstName = "Paulo";
sfLead.LastName = "Morales";
sfLead.LeadSource = "Testing";
// Add the account to an array of SObjects
sforce.sObject[] records = new sforce.sObject[] {sfLead};
// Invoke the create call, passing in the account properties
// and saving the results in a SaveResult object
sforce.SaveResult[] saveResults = binding.create(records);
// Access the new ID
String newID = saveResults[0].id;
}
binding.SessionHeaderValue = new sforce.SessionHeader();
binding.SessionHeaderValue.SessionId = (string)Session["sessionId"]