Free auditStart free
GuideError · HTTP status codes

401 Unauthorized in IIS

Read the IIS 401 sub-status (401.1 to 401.5, 401.501 to 401.504) and fix the cause: authentication methods, NTFS ACLs, filters, IP restrictions.

3 min
read
5
sources
Oct 29, 2026
updated
Scaplet Editorial Team
author
The short answer

IIS splits 401 into sub-status codes. 401.1 is a failed logon, 401.2 a server authentication configuration problem, 401.3 an NTFS ACL denial, 401.4 and 401.5 an ISAPI filter or CGI application, and 401.501 to 401.504 the IP restriction features. The sub-status tells you which fix applies.

  1. Read the sub-status before changing anything
  2. Authentication methods: the usual 401.2
  3. Reproduce and check it in 2 minutes
  4. Windows authentication specifics
  5. What it means for SEO and crawlers
30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
01Explained

Read the sub-status before changing anything

Microsoft's IIS status code reference lists the following 401 sub-status codes. One 401 can mean a wrong password, a missing authentication module or a file permission, and the sub-status is the quickest way to tell them apart.

IIS 401 sub-status codes and first thing to check
CodeMicrosoft's labelFirst check
401.1Logon failedUser name or password; whether the account exists
401.2Logon failed due to server configurationAuthentication settings: is any enabled method one the client can use?
401.3Unauthorized due to ACL on resourceNTFS permissions on the file and its folder
401.4Authorization failed by filterISAPI filters installed on the site
401.5Authorization failed by ISAPI/CGI applicationThe ISAPI or CGI application's own authorization
401.501Concurrent request rate limit reachedDynamic IP Restriction concurrent-request setting
401.502Maximum request rate limit reachedDynamic IP Restriction request-rate setting
401.503IP address deniedIP Restriction deny list
401.504Host name deniedIP Restriction deny list by host name

The reference says these specific codes are displayed in the client browser but not in the IIS log. By default IIS shows detailed error information only to a browser on the local server and a generic message to everyone else, because errorMode defaults to DetailedLocalOnly. So request the page from the server itself to see the sub-status, or set errorMode to Detailed temporarily while debugging.

02Check it

Authentication methods: the usual 401.2

IIS supports Anonymous, Basic, Client Certificate Mapping, Digest, IIS Client Certificate Mapping and Windows authentication. A method has to be both installed and enabled for the site. For Windows authentication, the docs say the default install of IIS 7 and later does not include the role service, and that you must disable Anonymous authentication and enable Windows authentication for the site.

The same change from the command line, which Microsoft's page shows with /commit:apphost:

appcmd: disable Anonymous, enable Windows authentication
appcmd.exe set config "Contoso" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:"False" /commit:apphost

appcmd.exe set config "Contoso" -section:system.webServer/security/authentication/windowsAuthentication /enabled:"True" /commit:apphost
Web.config or ApplicationHost.config: Basic and Windows on, Anonymous off
<location path="Contoso">
   <system.webServer>
      <security>
         <authentication>
            <anonymousAuthentication enabled="false" />
            <basicAuthentication enabled="true" defaultLogonDomain="Contoso" />
            <windowsAuthentication enabled="true" />
          </authentication>
      </security>
   </system.webServer>
</location>
03Fix it on your stack

Reproduce and check it in 2 minutes

A public endpoint shows what the challenge looks like. This one uses Basic, so the header names the scheme and a realm:
Public endpoint: see the 401 and its challenge header
curl -s -D - -o /dev/null https://httpbin.org/status/401
# Expect: HTTP/2 401 and a www-authenticate: Basic realm="Fake Realm" header
Your own IIS site: which authentication schemes does it offer?
curl -s -D - -o /dev/null https://intranet.example.test/ | grep -i www-authenticate
# With Windows authentication on, the default provider list from the docs is
# Negotiate then NTLM, so expect those schemes in the header.
Same site, sending your Windows credentials
Invoke-WebRequest -Uri https://intranet.example.test/ -UseDefaultCredentials | Select-Object StatusCode
# Expect: 200. A 401.1 here points at the account, a 401.3 at NTFS permissions.

On your own IIS site, the challenge header tells you which methods are enabled. This needs your host name:

04Check it

Windows authentication specifics

Windows authentication supports Kerberos and NTLM, and the default provider order in ApplicationHost.config is Negotiate then NTLM. The docs say it suits intranets because Kerberos needs a connection to Active Directory and NTLM does not work through HTTP proxy connections.

useKernelMode defaults to true. Microsoft's best practice is to leave it on if you use Kerberos with a custom application pool identity, since kernel-mode authentication can prevent authentication problems with such pools. If a Kerberos login works for the default identity and fails for a custom one, check that setting before touching SPNs.

Default Windows authentication providers from the docs
<windowsAuthentication enabled="false">
   <providers>
      <add value="Negotiate" />
      <add value="NTLM" />
   </providers>
</windowsAuthentication>
05Explained

What it means for SEO and crawlers

Google's documentation says it does not index URLs that return 4xx and that you should not use 401 or 403 to limit crawling. A site that returns 401 to everyone, including crawlers, will not have those pages indexed. That is correct for an intranet and wrong for a public page. If a public IIS page shows 401 to anonymous visitors, check whether Anonymous authentication is on at that path. For the sibling errors see 403 in IIS and 404 in IIS.
Sources · 5

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • microsoft.com
  • google.com
  1. 01HTTP status code overview - Internet Information Services (Microsoft Learn)learn.microsoft.com · checked 2026-11-01
  2. 02Security Authentication <authentication> (Microsoft Learn)learn.microsoft.com · checked 2026-11-01
  3. 03Windows Authentication <windowsAuthentication> (Microsoft Learn)learn.microsoft.com · checked 2026-11-01
  4. 04HTTP Errors <httpErrors> (Microsoft Learn)learn.microsoft.com · checked 2026-11-01
  5. 05How HTTP status codes affect Google's crawlersdevelopers.google.com · checked 2026-11-01
Questions

Asked a lot.

2 questions people ask next, answered from the sources on this page.

01What is the difference between 401.1 and 401.3 in IIS?

401.1 means the logon failed, probably a bad user name or password. 401.3 means NTFS permissions on the resource denied an identity that did log on.

02Why do I see a 401 once before the login succeeds?

The first request carries no credentials, so IIS answers with a 401 and the authentication challenge. The client then retries with credentials.

Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane