title: trying to get the username used to sign into the website
body: <p>I'm using the following code to check the user's credentials and if successful I put them to make-request.aspx, but on make-request.aspx I want to check the value of the username they entered so I can show certain content.</p>
  
  <p>Here's the authentication code:</p>
  
  <pre><code>foreach (string key in ConfigurationSettings.AppSettings.Keys)
  {
      dominName = key.Contains("DirectoryDomain") ? ConfigurationSettings.AppSettings[key] : dominName;
      adPath = key.Contains("DirectoryPath") ? ConfigurationSettings.AppSettings[key] : adPath;
  
      if (!String.IsNullOrEmpty(dominName) &amp;&amp; !String.IsNullOrEmpty(adPath))
      {
          if (true == AuthenticateUser(dominName, userName, txtPassword.Text,adPath, out strError))
          {
              Response.Redirect("../make-request.aspx");// Authenticated user redirects to default.aspx
          }
  
          dominName = string.Empty;
          adPath = string.Empty;
          if (String.IsNullOrEmpty(strError)) break;
      }
  </code></pre>
  
  <p>Everything works fine but I'm not sure how to get the username they entered into the form. Here's code that I've tried that is getting username of the machine username -- I think. Any help would be appreciated!</p>
  
  <p>I've tried all three of these:</p>
  
  <pre><code>//string userName = Environment.UserName;
  
  string userName = HttpContext.Current.User.Identity.Name;
  
  //string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
  </code></pre>
  
  <p>Here's the authentication/auth section of web.config:</p>
  
  <pre><code>&lt;authentication mode="Windows" /&gt;
  &lt;authorization&gt;
    &lt;allow users="*" /&gt;
    &lt;!--&lt;deny users="*"/&gt;--&gt;
  &lt;/authorization&gt;
  </code></pre>