I have an ASP.NET 3.5 web service (old school SOAP, not WCF) running on two servers set up identically in IIS 6.0. The Authentication/Access control is set up as follows:
- Enable Anonymous Access = False
- Integrated Windows authentication = True
- Digest authentication for Windows domain servers = False
- Basic authentication = False
- .NET Passport authentication = False
In one of the web methods, I need to get the Identity of the requesting user and validate that it's in a certain Active Directory group. So, the first line of code in the web method is this:
var requestUser = HttpContext.Current.Request.LogonUserIdentity.Name;
For some reason the results are different between the two servers. Server1 works as expected, producing domain\UserId
. However, Server2 produces Server2\IUSR_SERVER2
. Has anyone experienced this before? I did find this question, but I'm pretty sure it doesn't apply here as client and both servers are all in the same domain.
Additional Info
Based on Heinzi's response, I added the following to the <system.web>
section in both web.config files:
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
Now, Server1 behaves the same, as in, it behaves as I want it to. However, Server2 throws a 401.2: Unauthorized error:
Server Error in '/' Application.
Access is denied. Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance.
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3053