download file from https with credentials doesn't contain data
Stacy Bell
41
Reputation points
This downloads an online file but the file has the website's html code instead of data. How do you get the file to have data instead of html code?
var url = string.Format(@"https://www.test.com/Monthly%20Report"); WebClient webClient = new WebClient(); webClient.Credentials = new NetworkCredential("userName", "Password123"); webClient.Headers.Add("cookie", ""); webClient.DownloadFile(url, @"C:\Users\me\Downloads\Monthly Report.csv");
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Sign in to answer