Making a web request to a web page which requires windows authentication
I am trying to make a request to a web page using WebRequest class in .net. The url that I am trying to read requires Windows Authentication due to which I get an unauthorised exception. How can I pass a windows credentials to this request so that it can authenticate. HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create( "http://myapp/home.aspx" ); request.Method = "GET"; request.UseDefaultCredentials = false; request.PreAuthenticate = true; request.Credentials = new NetworkCredential( "username", "password", "domain" ); HttpWebResponse response = (HttpWebResponse)request.GetResponse