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
SF SandhyaSF Sandhya 

Destination URL not reset. The URL returned from login must be set in the SforceService



I am getting below exception while getting the opportunity objects from my account.

"UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService"


While login  i am setting the one url and once its done i am setting one more URL.


Before login

//if debug_mode use the following service urlif(isSalesForceDebugModeEnabled)

binding.Url =



After login


binding.Url = loginResult.serverUrl;


This is my login function.

privatestaticbool SalesForceLogin(SforceServicebinding)


LoginResult loginResult = null;


GetUserInfoResult userInfo = null;


// Time out after a minute

binding.Timeout = 60000;

// Try to log in the usertry


string username =;


string password = "password";

loginResult = binding.login(username, password);


catch (System.Web.Services.Protocols.SoapException)


// This is likley to be caused by bad username or password//AppError.AddError("SalesForce Login [Soap Exception]: " + e.Message, AppError.AudienceEnum.TechnicalTeam, AppError.LevelEnum.Exception);returnfalse;


catch (Exception)


// This is something else, probably comminication//AppError.AddError("SalesForce Login [Other Error]: " + e.Message, AppError.AudienceEnum.TechnicalTeam, AppError.LevelEnum.Exception);returnfalse;


//Create a new session header object and set the session id to that returned by the login

binding.SessionHeaderValue =


binding.SessionHeaderValue.sessionId = loginResult.sessionId;

userInfo = loginResult.userInfo;

//Change the binding to the new endpoint

binding.Url = loginResult.serverUrl;




While getting the opportunities it is raising the exception




QueryResult qr = null;

binding.QueryOptionsValue =


binding.QueryOptionsValue.batchSize = 250;

binding.QueryOptionsValue.batchSizeSpecified =



DescribeSObjectResult result = binding.describeSObject("Opportunity");


boolcanCreate = result.createable;


foreach(Field f inresult.fields)




qr = binding.query(

"select Name,Web_Order_Number__c,CloseDate,StageName,Tax_Amount__cSpecified,Promo_Code_Discount_Amount__cSpecified from Opportunity");


// qr = binding.query("select ID, Name, ProductCode, Description from Product2");



grdProducts.DataSource = qr.records;




 In describeresult object i am getting exception.What is the problem i could nt able to understand,

Note:I am new bie of salesforce.I dont know anything abt SF.Why they are setting 2 urls,who will give those urls,Is there any proper document .I have searched in net but full high teminology.I could nt able to understand.

Please provide me answer for above prob and Doc for SF



sfdcfoxsfdcfox uses an authentication server and API servers. The authentication server provides a token that will be used to access the system. Once this token is acquired, you move to the second URL, which is where all API actions are processed. The first URL is provided by the WSDL you are using, while the second URL is provided directly by servers on successful login. You should check your languages documentation to make sure you're not accidentally creating an expando property or passing by copy instead of passing by reference and using the correct member variable. Based on what I see here, I assume the problem is that you are not passing your binding by reference, but instead passing by copy.

Claudio Ungaro 5Claudio Ungaro 5
Hi, can you explain to me (struggling) how to pass the new URL as a reference?
Thank you
Claudio Ungaro 5Claudio Ungaro 5
Hi again,
Sorted out.... now that i know how to do it it is quite always .....LOL