Find your content:

Search form

You are here

Session ID in C#

 
Share

I have a component in C# i'm using for SF integration which all works fine. I currently have a custom C# login screen which uses the entered values to retrieve the SessionID.

However, i'd like to set it up so that if the user is already logged on to Salesforce through a browser then i can retrieve the SessionId from that session and so skip the login process. Any ideas if this is possible and if so how i go about it?

Thanks for any suggestions Paul


Attribution to: paul

Possible Suggestion/Solution #1

Im responding based on the assumption that the C# screen is a client based application and not a web app.

The session id is stored in the browser, in the cookie cache. getting the session id means getting the information from a number of different places, some possible ideas.

  1. man in the middle - you can monitor tcp traffic for the session id.
  2. you can scan the cookie folder for a session id
  3. you can write a browser extension that plucks the session id.

None of these options sound appealing to me in a client installed environment, better to just have them log in manually IMHO.


Attribution to: ebt

Possible Suggestion/Solution #2

You could put a custom link in salesforce that uses either a custom scheme registered to your app, or a localhost URL that your app is listening for, that could pass the sessionId & serverUrl (you need both) to your app. This would require the user to explicitly click something to start your app, which seems ok to me (otherwise, what if i'm logged into 2 different accounts in 2 different browser windows?).

Alternatively switching the Authentication process to OAuth would allow you to have the user only need to login once, rather than everytime they want to use the app.


Attribution to: superfell
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/509

My Block Status

My Block Content