Im doing a simple connection to a sharepoint 2010 site using clientcontext and im getting the error "cannot contact site at specified url".

  • The site (eg Site1) is a host-header site
  • it was migrated from 2007 successfully
  • it is using NTLM authentication, im not setting credentials while calling clientcontext.
  • There is another web application (say Site2, also a host-header site) on the same server, im able to connect to that via clientcontext successfully. It also uses NTLM.
  • The Site2 is a newly created site after the migration to sp 2010, in terms of setup its very similar to Site1 (simple Team Site etc).

My question is - is there any setting to be turned "on"/enabled on the webapplication/site/web level so that clientcontext should work? Especially if its a migrated (via db attach) site?

Appreciate any insights.

4 Answers 4


Finally found the answer to this problem. The web.config for the trouble-some site had a statement . Removed this and I was able to connect to the site normally. No idea why a session mode will conflict with a ClientContext call. There were other issues along the way too and i have blogged it in vasya10.wordpress.com. Someone may find it useful.

Thanks all for the pointers.


You should be able to get ClientContext to work without specifically enabling it.

Double check in IIS that the authentication and bindings are correct and in line with ShaerPoint too.

You may find an inconsistency when the migration from 2007 happened which left IIS in a different state.

  • thanks! will compare the iis settings between the two. Specifically the error trace is Microsoft.SharePoint.Client.ClientRequestException: Cannot contact site at the specified URL at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest() at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery() At this point isnt it beyond IIS?
    – vasya10
    Dec 23, 2011 at 4:57
  • If IIS passes through credentials that SP is not expecting (ie. forms) then SP will spit out the error.
    – Russell
    Dec 23, 2011 at 22:30

I faced this issue in my code and it was due multi authentication mode which was being used in my SP2010 server and the following article saved my ass.



You should not be able to connect to a site in another web application, if I understand correctly. Isn't this the equivalent of cross-site scripting?

Are you trying to connect to content in the web app "Site 1" from the web app "Site 2"? I don't think that would work. However, if you tried to connect to content in "Site 2" from within "Site 2", well, that would work, as it's within the same web application. This is by design.

Also, if you're trying to update information in one web application via the client object model, from a different web application, well, that would also result in an invalid FormDigest. This is for security, and is by design also.

  • no, they are two distinct calls from a remote machine from a console app. There is a webapp1/site1 and there is a webapp2/site2 , both in same server. Former was a migration from 2007, the latter fully 2010. otherwise, the perms etc. are exactly same. There is no update either, just connect, load web, print title.
    – vasya10
    Dec 23, 2011 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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