How to set the Site-Root Relative Path (for localhost) on IIS on my web application

一世执手 提交于 2020-01-15 07:12:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!