0

I'm using ASP.NET and making a website. I have a link to a pdf in some of my pages, but they all lead to 404 errors. I know the path is right as I used Visual Studio to generate the path, I didn't write it myself. Here you can see:

404 Error https://i.stack.imgur.com/x0A5p.png

Solution explorer, to show the path is right https://i.stack.imgur.com/itKrX.png

I searched this problem extensively, and the only solutions I found were for adding/removing mime pdf stuff from web.config and IIS application.config, but none of this was to any avail.

I also saw stuff involving code (like here Open PDF in web page of ASP.NET), but I don't think I should need any real code. I should just be able to link to the PDF resource on my server like other websites do.

Elsewhere on my site, I have a link to a PDF on another website which works perfectly. I'm not sure if this information is relevant or not.

If it matters, I'm using razor c#. The .NET and ASP.NET versions can be seen in the image above. The IIS version is

Caleb Johnson
  • 376
  • 3
  • 21
  • 3
    Why is it inside the `Views` folder? You can't access static files from that folder. Move it to a `content` folder. – adiga Oct 13 '17 at 17:54
  • @adiga thank you, that was it. I knew it didn't belong in the views folder but I just put it there temporarily for testing. I didn't think different folders actually had different properties, I thought it was just for organization. I feel stupid now. – Caleb Johnson Oct 13 '17 at 18:04
  • 1
    This is not stupid at all. Why do you think I knew of this right away :D Now you too will never forget this. – adiga Oct 13 '17 at 18:12

0 Answers0