Countless times, the .NET exception, The request failed with HTTP status 401: Access Denied dumbfounds developers. To determine under what user is trying to access a resource extend the default logging available in Internet Information Services (IIS).
- Right click on the Web Site you want to manage.
- Click Properties in the Enable Logging panel of the Web Site tab.
- Click the Extended Properties tab and check the User Name (cs-username) checkbox under Extended Properties.
Once the User Name is checked, the the windows user who is accessing the resource will be logged as below.
02:40:00 127.0.0.1 domain\username W3SVC1 AUHDQL99 POST /TestAuthentication/Default.aspx 500