3
votes

I have an ASP.NET MVC app and some folder that contains a lot of images. This directory is located outside my app folder. And I want to use images from this directory in my app in web pages without copying them to app directory. I created virtual directory for my application in IIS and called it MyOuterDir. It references to outer images directory. Then I wrote in my web page something like this :

<img src='/MyOuterDir/some.png' />

But it doesn't work, I faced with error 404:

GET http://localhost:85/MyOuterDir/some.png 404 (Not Found)

Where am I wrong? How to make IIS (or browser) properly read images from virtual directory?

P.S. It doesn't work even I change reference to folder located in app directory

2
Can you post your route config?squillman
@squillman I reproduced default asp.net mvc application and it has default route configPupkin

2 Answers

0
votes

I would check your web.config file, make sure you have permission for the file system.

    <location path="Folder/Logs">
    <system.web>
      <authorization>
        <allow roles="Admin" />
        <deny users="*" />
      </authorization>
    </system.web>
  </location>
      <location path="OtherFolder/Dump">
    <system.web>
      <authorization>
        <allow users="*" />
        <deny users="?" />
      </authorization>
    </system.web>
  </location>

If you don't have permission you won't be able to find the file/Image

0
votes

Try this way:

<img src='MyOuterDir/some.png' />

Good Luck!