在通过IIS请求的初始Load期间,图像未加载到MVC5 JQuery中

时间:2015-01-07 14:04:59

标签: asp.net-mvc-5

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”

1 个答案:

答案 0 :(得分:0)

尝试在<img src="~/Content/Images/xx.png">语法中使用Razor。这将为您的图像生成正确的路径。