Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Sharepoint 2013 HttpwebRequest error

$
0
0

Hi,

I am getting the following error when I try to login into sharepoint using the Httpwebrequest. 

Code is as follows

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("https://xyz.sharepoint.com/");

request.Credentials = new System.Net.NetworkCredential("ABC@xyz.onmicrosoft.com", "123456");
request.UserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
request.Method = "GET";

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

var val = response.GetResponseStream();

string sourceCode;

using (StreamReader sr = new StreamReader(getResponse.GetResponseStream()))
{
    sourceCode = sr.ReadToEnd();
} 


Ramakrishna


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>