Browse to a PDF in ASP.NET Web Site Folder

  asp.net, iis, pdf, windows

I have an ASP.NET Core web site running under IIS on a server. I created a folder and want to display any pdf file in that folder in the browser using the url for the site.

https://example.com/pdf/myfile.pdf

folder structure:
c:inetpubwwwrootmysitepdfmyfile.pdf – contains pdf files

I enabled Directory Browsing for the site in IIS Manager, but I get a 404 error.
I’m on Window Server 2019 IIS version 10.

Source: Windows Questions

LEAVE A COMMENT