title: get nt sid when user logs onto an asp page
body: <p>I'm wanting to grab a users NT SID when they access my page for secuity purposes..</p>
  
  <p>this sort of thing</p>
  
  <p>S-1-5-21-1614280859-2041256729-1847403543-2152 </p>
  
  <p>I can't seem to figure this out..  </p>
  
  <p>I saw a post that directed the OP to a book, but I don't want to buy a whole book just to do one thing.  In that post, they mentioned that the ObjectSID was part of the security token, but I have no idea how to get to this..</p>
  
  <p>Any help would be appreciated.  </p>
  
  <p>Thanks.. </p>
  
  <p>Solution thanks to Simon:</p>
  
  <pre><code>IntPtr logonToken = WindowsIdentity.GetCurrent().Token;
  WindowsIdentity windowsId = new WindowsIdentity(logonToken);
  string strSID = windowsId.User.ToString();
  </code></pre>