问题描述
|
我正在使用Visual Web Developer 2010部署到XP SP3 iis51。我已经在配置中设置了通配符。但是,我的图像没有显示,因为路径错误。它没有选择我的虚拟目录名称。
当我在本地浏览它时,它显示得很好,这就是我的图像元素的样子:
<img src=\"../../Content/Images/leftSpot.jpg\" alt=\"see properties\" />
我尝试过src = \“〜/ .. \”不起作用。
解决方法
请尝试以下操作:
剃刀:
<img src=\"@Url.Content(\"~/Content/Images/leftSpot.jpg\")\" alt=\"see properties\" />
网络表格:
<img src=\"<%=Url.Content(\"~/Content/Images/leftSpot.jpg\")%>\" alt=\"see properties\" />
**编辑(添加了网络表单答案)
,
这可以在我的MVC项目中进行测试。剃刀引擎。