Hi,
Thanks for the great add-on-method, exactly what I was looking for...
I also needed to pass in credentials, so I'm posting the changes I did here as well...
Thanks for the great add-on-method, exactly what I was looking for...
I also needed to pass in credentials, so I'm posting the changes I did here as well...
public void LoadUri(string uri)
{
LoadUri(uri, System.Net.CredentialCache.DefaultCredentials);
}
public void LoadUri(string uri, string userName, string password, string domain)
{
LoadUri(uri, new NetworkCredential(userName, password, domain));
}
public void LoadUri(string uri, ICredentials credentials)
{
if (uri == null)
throw new ArgumentNullException("uri");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Credentials = credentials;
request.Timeout = 1 * 60 * 1000;
using(HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (StreamReader sr = new StreamReader(response.GetResponseStream()))
{
Load(sr);
}
}