using (var client = new WebClient())
{
client.UseDefaultCredentials = true;
client.Credentials = new NetworkCredential("abcd","abcd1234");
string downloadlink_INC="https://completeurl.com/";
client.DownloadFile(downloadlink_INC, "downladed.csv");
}
Trying to download a .csv file from a logged in web account which uses windows authentication. But here I have given a default network credentials to allow those users as well which don't have access to the website. The link I am passing is downloading the .csv file from the browser in the download folder, but when the same(https://completeurl.com/) is being used via C# code the content is HTML code not the columns.
Through c# the file is nothing but the html code of the page.
Thanks in advance!!