Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

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
add comment

3 Answers

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, 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

share|improve this answer
add comment

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

share|improve this answer
add comment

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.

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
add comment

Your Answer

 
discard

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.