Note that there are some explanatory texts on larger screens.

plurals
  1. POUsers Indistinguishable in Hosted ASP.Net Application
    text
    copied!<p>I am working on a hosted ASP.Net application, with Windows Authentication, and I need to get the username for various personalisation tasks. The directory on the host machine is set to have Windows Authentication and the <code>web.config</code> file also has:-</p> <pre><code>&lt;authentication mode="Windows"&gt; &lt;/authentication&gt; </code></pre> <p>in it. I have tried various methods within the application to get the user name with the following results:-</p> <pre><code>Source Result System.Web.HttpContext.Current.Request.LogonUserIdentity.Name 'EZ\urlname_a' System.Environment.UserName 'NETWORK SERVICE' System.Web.HttpContext.Current.User.Identity.Name '' this.Request.ServerVariables["LOGON_USER"] '' this.Request.ServerVariables["AUTH_USER"] '' this.User.Identity.Name '' </code></pre> <p>thanks to the answers <a href="https://stackoverflow.com/questions/19249887/reading-windows-credentials">here</a>, <a href="https://stackoverflow.com/questions/15280402/get-client-user-name-from-a-web-application-running-in-a-web-server-with-windows">here</a>, and <a href="https://stackoverflow.com/questions/5000100/request-logonuseridentity-name-returns-asp-net-server-credential-not-the-users-c">here</a>, among others. None of these distinguish between the various usernames that were entered.</p> <p>Is there anything else I can try in code to get the name (or some proxy for the name)? Is there anything I can check for in <code>web.config</code>? Or if I need to take the matter up with the host, is there any intelligent question I can ask?</p> <p><strong>Edit</strong> I have set the application directory and .Net version using the host's IIS Dialogue.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload