title: c# getting ip address of user who remotely connect to machine
body: <p>I am using following piece of c# code in windows service to capture Remote connect and disconnect events. </p>
  
  <p>How I can get the IPaddress of end user who remotely connect to that machine. </p>
  
  <pre><code>protected override void OnSessionChange(SessionChangeDescription changeDescription)
   {
          switch (changeDescription.Reason)
          {
              case SessionChangeReason.RemoteConnect:
                  //Remote Connect
                  break;
              case SessionChangeReason.RemoteDisconnect:
                  //Remote Disconnect
                  break;
              default:
                  break;
          }
   }
  </code></pre>