Monday, March 26, 2012

Permission & Access problem.

Greetings everyone,

I want to grab some data from a local site hosted on sharepoint services. I tried using the HttpWebRequest & HttpWebResponse classes. Here is the exact code
-----------------------
string lcUrl = "http://xxxxx/";

HttpWebRequest loHttp = (HttpWebRequest) WebRequest.Create(lcUrl);
loHttp.Timeout = 10000;
loHttp.UserAgent = "Code Sample Web Client";
HttpWebResponse loWebResponse = (HttpWebResponse) loHttp.GetResponse();
-----------------------

The problem is I could not open the connection because maybe the site does not allow anonymous access. How do I provide my credentials and open the site and retrieve data.The Credentials property - use a System.Net.NetworkCredential instance containing the details for a user with administrative rights on SharePoint, and also set the PreAuthenticate property to "true"

0 comments:

Post a Comment