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 extended the DataFormWebPart to use a SoapDataSource and get the data from the lists.asmx webservice

it works fine as long as i access data from the same webapplication but as soon as i try to get some data from another webapplication i get the execption.

System.Net.WebException: The remote server returned an error: (401) Unauthorized

My code looks like this:

private SoapDataSource CreateDataSource(string webUrl, string listName)
    SoapDataSource source = new SoapDataSource();
    source.WsdlPath = string.Format("{0}_vti_bin/lists.asmx?wsdl", webUrl);
    source.SelectUrl = string.Format("{0}_vti_bin/lists.asmx", webUrl);
    source.SelectAction = "";
    source.SelectPort = "ListsSoap";
    source.SelectServiceName = "Lists";
    source.AuthType = "None";
    source.SelectCommand = string.Format(@"<soap:Envelope xmlns:soap=""""><soap:Body><GetListItems xmlns=""""><listName>{0}</listName></GetListItems></soap:Body></soap:Envelope>", listName);

     return source;

When i change the type to "Basic" and set the AuthUser and AuthPassword to an authorized user it works (but not with Auth="Windows" The Webapplications have the same apppool user and are on the same farm (i already checked that registry DisableLoopbackCheck-thing))

share|improve this question

This sounds like it may be the double hop issue. In this instance you're asking the web server to impersonate the user with a request to another web service (regardless of whether its on the same machine or not)

Unless you're using Kerberos, then you won't be able to use windows authentication as NTLM won't delegate. The fact that when you set a Username and Password in the code it works i think confirms this theory.

Use Kerberos, or Use a static username and Password are I think your only options.


share|improve this answer

There are many possibilities for this error. Check out these link, maybe it could help you.

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.