1.将URL指向“http:/ servername / virtualdirectory”时,例如我在js文件中使用jquery将图像路径设置为../Content/Images/xx.png,然后未加载图像
2.当将URL指向“http:/ servername / virtualdirectory / controllername / action”时,例如我在js文件中使用jQuery将图像路径设置为../Content/Images/xx.png,那么图像是加载。
问题是为什么在来自routeconfig.cs的IIS请求期间没有加载图像,即MVC5中的“http:/ servername / virtualdirectory”
答案 0 :(得分:0)
尝试在<img src="~/Content/Images/xx.png">
语法中使用Razor
。这将为您的图像生成正确的路径。