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

1 Answer

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