I have asked this question on stackoverflow as well but no answer.
I'm trying to call sharepoint webservices in a C# console application. The code works fine when I use my local system's WSS as target application but it doesn't work with another server accessible over the web. Here is my code:
Webs service = new Webs();
service.PreAuthenticate = true;
service.Credentials = new System.Net.NetworkCredential(login, password);
//service.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
service.Url = url + @"/_vti_bin/webs.asmx";
XmlNode sites = null;
try
{
sites = service.GetWebCollection();
}
catch (Exception ex)
{
return;
}
Points to note:
It neither work with DefaultNetworkCredentials nor with my domain user credentials.
The webservice end point if pasted in a browser successfully list the web service methods.
- I get 401 unauthorized error in all cases(accessing the remote server).
Am I missing something?