Get windows logged user on REST Web Api
<p>I have a REST API already up and running. Now I'm trying to do a log service.</p>

<p>The idea is to log on a database table all operations made by the user on the client app.</p>

<p>Since it is for internal usage (only used on intranet) I'm using Windows Authentication (<code>&lt;authentication mode="Windows" /&gt;</code>).</p>

<p>The log service is already working with one problem. I can't get the logged user.</p>

<p>If I run the API and the client app on my local machine, I can get my user. But when I publish I can't.</p>

<p><strong>What I already tried:</strong></p>

<pre><code>string userName = WindowsIdentity.GetCurrent().Name;

string userName = HttpContext.Current.User.Identity.Name;

string userName = HttpContext.Current.Request.LogonUserIdentity.Name;

string userName = Environment.UserName;
</code></pre>

<p>I get all sorts of userNames (<code>IUSR</code>, <code>IIS APPPOOL\MyApi</code>, <code>MyApi</code> and also blank) but not the windows logged user.</p>

<p>I have <strong>Windows Authentication</strong> <em>enable</em> on IIS.</p>

<p>Can anyone tell me if this is possible? And if it is, how to do it?</p>