Wednesday, December 16, 2009

HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials. asp.net , ajax , javascript , Adsutil.vbs iis , c#.net , microsoft ,

HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.

The error is comming usually when you try to access microsoft internet information service 6.0 website which is configurred to use windows authentication only, you may be prompted for your user credentials. When try to logon will receive logon prompt again. After trying to logon several times will receive the error message.


The situation which causes this error is

IIS 6.0 website is part of IIS application pool and the application pool is running under a local account or under domain user account. And the wesite is confugurred to use windows authentication.

To resolve this problem follow the steps below

1. Install the Setspn.exe tool from the following website

http://www.microsoft.com/downloads/details.aspx?FamilyID=5fd831fd-ab77-46a3-9cfe-ff01d29e5c46&displaylang=en (http://www.microsoft.com/downloads/details.aspx?FamilyID=5fd831fd-ab77-46a3-9cfe-ff01d29e5c46&displaylang=en)

2. start->run-cmd to change the path of setspn.exe

3. In the command prompt change to the directory where you installed setspn.exe

4 Type the following commands

setspn.exe -S http/IIS_computer's_NetBIOS_name DomainName\UserName

setspn.exe -S http/IIS_computer's_FQDN DomainName\UserName


If you have multiple application pools which all run under domain user accounts then you must force iis to use NLM as your authentication mechanism. To do this follow the following steps


1. Start->run->cmd

2. change the directory to which contains Adsutil.vbs. By default it will be.

C:\Inetpub\Adminscripts.

3. Type the following command and pres enter.

cscript adsutil.vbs set w3svc/NTAuthenticationProviders "NTLM"
4. to verify that the Ntauthenticationproviders metabase property is set to NTLM type the following command.

cscript adsutil.vbs get w3svc/NTAuthenticationProviders


Then it should return

NTAuthenticationProviders : (STRING) "NTLM"

3 comments:

  1. Its taken me about 2 days to find this fix. Thank you very very much.!

    ReplyDelete
  2. I have the same issue on IIS 7. Any idea how to resolve this?

    ReplyDelete
  3. no idea how it works

    ReplyDelete