1. Use System.Net.
using System.Net;2. Create a HttpWebRequest using the URL you want to read. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); //Replace the URL3. Create a network credential using the domain\username and password.
NetworkCredential networkCredential = new NetworkCredential("DOMAIN\\USERNAME","PASSSWORD"); // Provide the Domain\\UserName and Pasword4. Request setting. request.PreAuthenticate = true;
request.Credentials = networkCredential;
request.CookieContainer = new CookieContainer();5. Create HttpWebResponse and read from Stream. HttpWebResponse response = null;
string data = "";
try
{
response = (HttpWebResponse)request.GetResponse();
using (StreamReader sr = new StreamReader(response.GetResponseStream()))
{
data = sr.ReadToEnd();
sr.Close();
}
response.Close();
}
catch (WebException ex)
{
//Handle Exception
}