Question

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 http://demo.somedomain.com, 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.

Was it helpful?

Solution

This could be the infamous loopbackcheck error. When accessing a site through a host header other than the actual machine name, asp.net 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

OTHER TIPS

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: http://support.microsoft.com/kb/943280

I think this is what you are looking for:

http://blogs.msdn.com/b/cjohnson/archive/2011/05/03/authentication-with-sharepoint-online-and-the-client-side-object-model.aspx

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top