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

share|improve this question
    
Yes I am able to login using devbox\testuser via browser. –  Vivek Sep 21 '10 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. –  Marek Grzenkowicz Sep 21 '10 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 Sep 21 '10 at 7:39
    
James can you please re-explain "try to manually load Lists.asmx" –  Vivek Sep 21 '10 at 8:33
    
I guess he meant you should try to navigate to http://<site>/_vti_bin/Lists.asmx. –  Marek Grzenkowicz Sep 21 '10 at 10:23
show 3 more comments

1 Answer 1

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();
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.