I am trying to download a file using system.net.webclient.downloadfile method in asp.net core. I am facing an issue for a specific file name.
Name of the file is
There is something to download #12344.pdf
It is throwing me an error file name "There is something to download" can not find.
The issue is characters after # is not recognized by the DownloadFile method.
Example Code:
string remoteUri = "http://www.contoso.com/library/homepage/images/";
string fileName = "ms-banner #1234.gif", myStringWebResource = null;
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
// Concatenate the domain with the Web resource filename.
myStringWebResource = remoteUri + fileName;
// Download the Web resource and save it into the current filesystem folder.
myWebClient.DownloadFile(myStringWebResource, fileName);
any suggestions would be helpful