Showing posts with label Visual Studio 2010. Show all posts
Showing posts with label Visual Studio 2010. Show all posts

Tuesday, May 18, 2010

SharePoint 2010 - the request failed with http status 401 unauthorized

I was getting below error, when I am trying to connect to SharePoint 2010 SiteData.asmx webservice. from VS 2010 asp.net website
the request failed with http status 401 unauthorized

Solution
System.Net.NetworkCredential myCredential = new System.Net.NetworkCredential();

myCredential.UserName = "";
myCredential.Password = "";
 
The above code has been changed as
myCredential = new NetworkCredential("username", "password", "domain");
 
Started working

Monday, May 17, 2010

operation is not valid due to the current state of the object.

I got below error, when I am trying to add SharePoint 2010 Site Data web service in to my Visual Studio 2010 website. "operation is not valid due to the current state of the object."

The above error is due to proxy authentication.

This can be solved by adding the below lines to web.config