Hi,
I'm trying to download the web page source code from a HTTPS URL, my code is as follows:
I get a 401 (unauthorized) exception, and i am 100% sure the credentials are correct, and work perfectly in my web browser for the file.Code:System.Net.WebClient WC = new System.Net.WebClient(); NetworkCredential Cred = new NetworkCredential(); Cred.UserName = "user"; Cred.Password = "pass"; WC.Credentials = Cred; System.IO.Stream s = WC.OpenRead("https://xxxxxx/data.html"); System.IO.StreamReader sr = new System.IO.StreamReader(s); string webpage = sr.ReadToEnd();
I have tested this code without the credentials, on a standard HTTP URL and it works fine.
Any ideas what I am doing wrong?
Thanks
Jack