1

I am facing this weired issue while trying to call the GetList method of the Lists.asmx web serice from my local dev box. Everything works fine as long as I pass default credentials

listProxy.Credentials = System.Net.CrderntialCache.DefaultCredentials;

But things go wrong as soon as I pass my credentials:

listProxy.Credentials = new System.Net.NetworkCredential("devbox\testuser", "password");  

or

listProxy.Credentials = new System.Net.NetworkCredential("testuser", "password","devbox");  

Note: I have added testuser in the Site Owners group on target SharePoint site collection.

My Development Machine Configuration:

  1. Win2k3 SP2
  2. No AD installed - devbox is the machine name.
  3. Standalone MOSS Installation
  4. VS2008

I even tried disabling the loopbackcheck by adding this entry to the registry disableloopbackcheck 1

What can be the possible issue?

8
  • Yes I am able to login using devbox\testuser via browser.
    – Vivek
    Commented Sep 21, 2010 at 7:00
  • 2
    Isn't \t in the 2nd snippet treated as an escape sequence? Try to use "devbox\\testuser" or @"devbox\testuser" instead. Commented Sep 21, 2010 at 7:19
  • If you're able to login as the test user, try to manually load Lists.asmx whilst logged in, and also double check that you can navigate the List you want to interrogate whilst logged in too.
    – James Love
    Commented Sep 21, 2010 at 7:39
  • James can you please re-explain "try to manually load Lists.asmx"
    – Vivek
    Commented Sep 21, 2010 at 8:33
  • I guess he meant you should try to navigate to http://<site>/_vti_bin/Lists.asmx. Commented Sep 21, 2010 at 10:23

1 Answer 1

2

I had a similar issue recently and it was because the security binding was incorrect in the app.config/web.config. For me it needed to be

<security mode="TransportCredentialOnly">
    <transport clientCredentialType="Ntlm" />
</security>

rather than the default which was

<security mode="None">
    <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
    <message clientCredentialType="UserName" algorithmSuite="Default" />
</security>

I was using VS2010, not sure if that is relevant but my C# was slightly different to yours as well.

UserGroupService.UserGroupSoapClient client = new UserGroupService.UserGroupSoapClient();
client.ClientCredentials.UserName.UserName = "Username";
client.ClientCredentials.UserName.Password = "Password";
client.ClientCredentials.SupportInteractive = true;
System.Xml.Linq.XElement users = client.GetUserCollectionFromGroup(GroupName.Text);
ResponseXml.Text = users.ToString();

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.