You need to enable static assets
[https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/static-files?view=aspnetcore-7.0
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The blazor server app has a folder that contains pdf files, the folder has web config file, see the below
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension, LongDate" />
</system.webServer>
</configuration>
I use the following <a> html link to browse the folder, it work on asp.net form project, but does not work on blazor server project, get "Sorry, there's nothing at this address." message. this folder is in wwwroot folder.
<a href="./PDFFiles/Production">View Production Files</a>
how to resolve this issue? thanks
You need to enable static assets
[https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/static-files?view=aspnetcore-7.0
because there is no file extension, the javascript routing for blazor will try to route to a blazor page.
you should make the pdf folder a peer, and define a folder for the blazor app
.if you define the static file handler, you coudl use <a target="_blank ...> to bypass the javascript router.
I did resolve it.
use the following, instead of <a href=".\PDFFiles\Production">Production</a>
<a href=".\wwwroot\PDFFiles\Production">Production</a>
the PDFFile Folder is inside wwwroot folder.
Thank you.