HtmlWeb.Load
has a number of overloads, these accept either an instance of NetworkCredential
or you can pass in a username and password directly.
Name // Description
Public method Load(String) //Gets an HTML document from an Internet resource.
Public method Load(String, String) //Loads an HTML document from an Internet resource.
Public method Load(String, String, WebProxy, NetworkCredential) //Loads an HTML document from an Internet resource.
Public method Load(String, String, Int32, String, String) //Loads an HTML document from an Internet resource.
You do not need to pass in a WebProxy
instance, or you can pass in the system default one.
Alternatively you can wire up the HtmlWeb.PreRequest
and setup the credentials for the request.
htmlWeb.PreRequest += (request) => {
request.Credentials = new NetworkCredential(...);
return true;
};