SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am connecting to SharePoint via managed client api. ClientContext connects to the site and access the list data when I specify the site address as http://computer_name but when I give the configured alternate access mapping like, I end up with 401 Unauthorized exception.

Both computer name and alternate mapping works without problems when I use the browser to access the site.

PS: I am trying to access the site over the internet.

Any help is appreciated.

share|improve this question
Did you find a solution for this? I do not get 401, but keep getting "Cannot contact site at specified url". I'm connecting to sharepoint site via hostheader web app url. – vasya10 Dec 22 '11 at 5:27
up vote 2 down vote accepted

This could be the infamous loopbackcheck error. When accessing a site through a host header other than the actual machine name, will throw a security error.More info here:

You receive error 401.1 when you browse a Web site that uses Integrated Authentication and is hosted on IIS 5.1 or a later version

share|improve this answer

The issue here is that you are accessing the resource from a FQDN. Service calls happen outside of the explorer security zones and use winHTTP, as such it interprets single name as intranet and forwards credentials and FQDN as Internet and prompts... In an unattended scenario this means the call fails as unauthorized.

Solution is to add th FQDN to the AuthForwardServerList registry entry as per this article:

share|improve this answer

I think this is what you are looking for:

The authentication method for the Client Object Model for Office 365 is a little different than the authentication for on-premise SharePoint environment. Thats the reason you might be getting the 401 error.

share|improve this answer
I know this solution but unfortunately this solution is far from being functional in the context of a service application. It is impossible to do authentication on behalf of users. – Élodie Petit Jul 26 '11 at 12:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.