title: How to get a Unique ID for the current user's logon session in windows - c#
body: <p>I need to get a value that uniquely identifies the current windows user's logon session. This is for a winforms app, not ASP.NET. I'll be retrieving this from within multiple processes so it needs to return the same value when retrieved within the same logon session. It only needs to be unique on the current machine for the duration of all user sessions - e.g. until the machine is next restarted. </p>
  
  <p>I think the <a href="https://stackoverflow.com/questions/2146153/how-to-get-the-logon-sid-in-c">Windows Logon Id</a> is the right thing, but seems a bit of a pain to retrieve. Is there anything else or any easier way to get this? </p>
  
  <p>I'll be using the ID to include in an address of a named pipes service to communicate between two processes running on the machine. I want to include the Logon Id to avoid conflicts when there are multiple users logged in, including perhaps multiple sessions of the same user.</p>