I am trying to use the below code to download and read the bytes of a document using System.NET.WebClient class. The file is in a SharePoint document library and the web application is using SSL. The code throws the exception 404 not found when executing the last line below.
WebClient webClient = new WebClient(); webClient.UseDefaultCredentials = true; webClient.DownloadData("https://sharepointwebsite/document-library/Test.docx");
The program is running in the context of System Account user and if I try to access the above URL in the browser it works and downloads the file. What settings do I need to do in IIS or in my code for it to work? This works on a separate box for the same website but without SSL.