未在mvc项目中显示的图像部署到xp

问题描述

| 我正在使用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项目中进行测试。剃刀引擎。     

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...