title: WCF - Get Current User Identity
body: <p>I have a silverlight application that send calls to a server. The server use WCF service to perform the call. I want to be able to check on the 'AfterReceiveRequest' function if the user who performs the call is the one I expected. if not - I want to abort the operation. </p>
  
  <p>The problem is - I can't get the IIS user name properly.
  I tried this properties:</p>
  
  <pre><code>OperationContext.Current.ServiceSecurityContext.WindowsIdentity.Name
  </code></pre>
  
  <p>And</p>
  
  <pre><code>OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name
  </code></pre>
  
  <p>They give me the right user name only when I run the application from Visual Studio, and not on the Application Pool. When I run the application on the Application pool I get in both these parameters the value: IIS APPPOOL\MyApplicationPool.</p>
  
  <p>The Client and Server are on the same machine, so this doesn't seems like a double-hop.</p>
  
  <p>Can anyone help? I need this to work in both Windows and Basic authentication.</p>