WebClient ws = new WebClient();
ws.Credentials = new System.Net.NetworkCredential(username, password, domain);
ws.DownloadFile("https://xxxx.xxxx.com/xxxx.xml", @"C:\Windows\TEMP\Downloaded.xml");
I got error 'Object reference not set to an instance of an object'. Anyone know why?
If I copy the "https://xxxx.xxxx.com/xxxx.xml" to browser, it can download and save to "C:\Windows\TEMP\Downloaded.xml", but my program can not, only throw the error.
Previously I use the same code successfully download the file, but that was another site with 'http'. Not sure whether it's the cause of the problem.