Imagine there’s a web (mvc) application, which home directory on the server is the default c:\intepub\wwwroot. What i need is:
- user requests http://server/randomPicture
- Server responses with a simple page with a random picture on it from a predefined path, which is not iis folder/app, like
d:\lolcats\
This sample is tremendously simplified, of course. My solution is: when /randomPicture/ is requested, copy random picture to APP_Images/current_response.jpg or whatever to application home folder and then simply render
<img src="../APP_Images/current_response.jpg" />
Is this the only solution or there’s a more civilized way to do it?
There are many ways to do it but simplest is the least geeky one: Just create a virtual folder for the image location in the IIS.