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

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.

share|improve this question

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.

share|improve this answer
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 '11 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 '11 at 22:30

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.

share|improve this answer
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 '11 at 15:07
up vote 0 down vote accepted

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 Someone may find it useful.

Thanks all for the pointers.

share|improve this answer

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.