I am trying to use System.Net.WebClient to download a file from a website. I am able to download specific files in general just fine using this method: The general idea is to use the following:
WebClient Client = new WebClient();
Client.DownloadFile("https://www.Example.File.xlsx", @"D:\MyDirectory\MyFile.xlsx");
But my problem is that I am not downloading a visible file per se from the website. Instead the file I need to download is embedded inside of an anchor tag with javascript as below:
<a href="javascript:downloadfile();">Export File</a>
So the piece I am missing is how to convert this anchor tag into a proper file to feed into my WebClient DownloadFile process. Does anyone happen to know the missing step here?
I am building this in a C# console app, so the solution will need to be compatible with this.
Thanks in advance.