title: IIS Mixed Anonymous and Windows Authentication
body: <p>I need to create an ASP .NET web page (hosted on Windows Server 2008R2 with IIS 7.5) which should be visible by domain users and anonymous users without prompting credential requests for both of them. Domain Users should be authorized to see the entire page, while anonymous users can see the public part of the page.</p>
  
  <ul>
  <li><strong>When I enable Windows authentication:</strong> domain users can see the entire page, but anonymous users are prompted for credentials. </li>
  <li><strong>When I enable anonymous authentication or both (anonymous and windows):</strong> anonymous users can see public part of the page, but domain users do not see the entire page (they are like anonymous users).  </li>
  </ul>
  
  <p>I use the following string to discriminate anonymous users and domain users: </p>
  
  <p><strong>WindowsAccountName = HttpContext.Current.Request.LogonUserIdentity.Name;</strong></p>
  
  <p>If WindowsAccountName is empty user is anonymous, otherwise is a domain user. Unfortunately, when anonymous authentication is enabled WindowsAccountName is always empty (even for domain users), but when anonymous authentication is disabled non-domain users are prompted for credentials. </p>
  
  <p>Do you have any solution for these problem? Keep in mind that domain users are spread among different networks so IP address is not a good choice to discriminate domain users and non-domain users. </p>
  
  <p>it looks like a catch-22 for me </p>
  
  <p>Thanks. </p>