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

Invalid Session when trying to Integrate .NET to Salesforce


We have built a .NET to Salesforce Integration, and .NET Client keeps sending Data to Salesforce via Custom Webservice written in Apex. (Endpoint is dynamically generated after Login call). 


We use the Partner WSDL to authenticate and dynamically generate the Endpoint URL. We store the Session ID and re-use it until it expires and then again relogin with credentials to get the New Session ID. 


The Integration was working fine for 3 months and all of sudden Salesforce Starting Rejecting the Sessions since last 1 week.


Not sure what has changed but this issue broke our integration and we are getting lot of complaints from users. 


Can you please shed some light on what might be the Issue?  I also have validated if "lock sessions to originating IP" is turned on and it is NOT. 


So we are now out of options. 







The lifetime of an access token obtained by the above mechanisms is limited to the session timeout configured in Setup ? Security Controls ? Session Settings. When an access token expires, attempts to use it, then will result in an error response with a 401 HTTP status code and a JSON-encoded body of

[ { message: 'Session expired or invalid'


In this situation, the client application can use the refresh token to obtain a new access token. The refresh token represents the user's access grant to the application, and is valid until explicitly revoked by the user, via Setup ? My Personal Information ? Remote Access.

The client application obtains a new access token by POSTing another request (4) to, this time with payload of the form:


grant_type Set this to refresh_token.
client_id Your application's client identifier.
client_secret Your application's client secret (optional).
refresh_token The refresh token provided in the previous access grant.

On receipt of the access token, the client can repeat its request

For more Information :


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.