This is a Blazor server rendered project, in .NET 9, published on IIS.
I'm trying to pull paths to images and other files from the database that are currently stored in the format:
~/TopicDirectory/Images/ImageFileName.jpg
When put as the source for an image tag, it's not displaying (and going to the path 404s).
I figured out I needed to do a substring to remove the leading ~/
<img src="@TopicItem.Image.Substring(2)">
If I add the source image to the project before publishing it, in the same directory structure, the image displays. E.g. wwwroot/TopicDirectory/Images/ImageFileName.jpg.
However, files will need to be added to that directory after the publishing of the new website so I need it to be able to read things that aren't published with the project.
I've ensured static files are enabled in IIS as I read that could be a factor.
I've tried adding just the TopicName\Images folder to the project structure and adding the images/other files after and it doesn't load them.
I've tried accessing the path pulled from the DB without the file being contained in the project and it fails.
Adding the file to the project before publishing it with all other aspects the same succeeds.
Adding additional files to the directory created in the fashion fails.
I've ensured the application identity user is the one accessing the files using procmon and that it has permissions to that directory.