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 have a site on DOMAIN\PC1 with url http://site1. I can access it by using following code (code is running on DOMAIN\PC1):

using(SPSite site = new SPSite("http://site1"))


Also there is a site with url http://site2 on machine DOMAIN\PC2 in the same domain. The code presented below fails (code is also running on DOMAIN\PC1):

using(SPSite site = new SPSite("http://site2"))


How to access http://site2 on DOMAIN\PC2 programmatically by code run on DOMAIN\PC1?

share|improve this question
up vote 1 down vote accepted

Are these sites in the same Farm? The code you have above will only be able to access SPSite object that runs on the same Farm as where you are in now. In other words, you cannot Access sites from a different farm.

If you really need to access some data, then you will have to call the Web Services on "http://site2"

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.