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
TzafrirbenTzafrirben 

Verify user is still logged in and session is not expired

We have a .NET service to communicate with SF. The .NET service logs in to SF once using a valid user, and after that all API calls to SalesFroce.com uses that user session ID.

 

The problem is: how can we tell when the session of this user was expired and he needs to re-login? currently it is done by catching exception, but this is probably not the  best way to do it.

 

Thanks

TzafrirTzafrir

Well, the only reasnoble solution I've found was to do a call to SF and catch and exception. In the exception we verify if the session is valid or not.

 

try

{

 GetUserInfoResult userInfo = binding.getUserInfo();

}

catch (Exception Ex)

{

}