问题
I create a new Web Site, in localhost, called Example1, on Visual Studio (2008); than if I wrote :
<img src="/private_images/club.png" />
the "path" that IIS should consider of should be localhost/Example1/private_images/club.png
, but in fact it consider localhost/private_images/club.png
.
So I should configure out IIS and my application in the right way (for each application). I know I can do it, because, in fact, online (from my hosting) it works as well.
How can I do it? Tried this solution, but on virtual path I already have Example1
.
Also, reading ASP.NET Web Project Paths, seems that IIS doesnt recognize the "folder that is located under the Web site root" :
site-root relative path, which is resolved against the site root. Site-root relative paths are useful if you keep resources that are used throughout the site, such as images or client script files, in a folder that is located under the Web site root. The following example path assumes that an Images folder is located under the Web site root.
So, in fact, what I'm looking for is how to change the site-root relative path
EDIT I know I should use ~
and put runat="server"
on elements, but I want to avoid this workaround, configuring my website as my hosting has done online.
来源:https://stackoverflow.com/questions/9700260/how-to-set-the-site-root-relative-path-for-localhost-on-iis-on-my-web-applicat