“The HTTP request is unauthorized with client authentication scheme ‘Anonymous’. The authentication header received from the server was ‘NTLM’.”

I spent more than 4 hours to resolve the following error.

“The HTTP request is unauthorized with client authentication scheme ‘Anonymous’. The authentication header received from the server was ‘NTLM’.”

I got this error when I tried to write a simple call “GetList(“Site Pages”) ” from List.ASMX service.

TO RESOLVE Do the following steps, after adding web reference to the service on a simple console application. using “http://[YOUR HOST HERE]/_vti_bin/lists.asmx

1.  Add the following line

ServiceReference1.ListsSoapClient list = new ServiceReference1.ListsSoapClient();

list.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;

 2. Also make sure in the app.config file you have the following.

<security mode="TransportCredentialOnly">
      <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" realm=""/>
      <message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
 

I hope this helps, if you have the same error.

 

 

 

About these ads
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to “The HTTP request is unauthorized with client authentication scheme ‘Anonymous’. The authentication header received from the server was ‘NTLM’.”

  1. Wesley says:

    Thanks, this saved me a good bit of time. I was missing the security mode from other articles on this issue that I had read.

    Thanks again!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s