'Open and/or download a file from a server location to the client computer (C#, Blazor Server App)

I have a file located inside a folder on my server: F:\Data\Attachments\a.pdf.

I'm using Blazor server app with asp.net 5.0 and C#. Up to now, the user that uses the application can upload this file. This file is correctly saved inside my server folder.

I can open the file with the powershell on my computer on which the Blazor Server App is running thanks to \\ip_server\Data\Attachments\a.pdf and I checked the permissions of the folder on the server.

I want to create a button that consent to download the file on the client machine (so, notify the browser and open the save dialog to choose the destination) or something similar because I tried everything without success.

I also tried to open the file using a link <a href="file:////ip_server/Data/Attachments/a.pdf" >link</a>.

When my file was located inside the project folder, I had no problem. So, how can I solve this issue? Is there something that I'm missing?

If you need any other information, please ask.

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source