开发者

image not displaying in mvc project deploy to xp

开发者 https://www.devze.com 2023-03-12 09:21 出处:网络
I am using visual web developer 2010 deploying to xp sp3 iis51. I\'ve setup my wildcard in the configuration. However, my images don\'t show up because the path is wrong. It i开发者_运维百科s not pick

I am using visual web developer 2010 deploying to xp sp3 iis51. I've setup my wildcard in the configuration. However, my images don't show up because the path is wrong. It i开发者_运维百科s not picking up my virtual directory name.

It shows just fine when I browsing to it locally and this is what my image element looks like:

<img src="../../Content/Images/leftSpot.jpg" alt="see properties" />

I've tried src="~/.." doesn't work.


Try the following:

razor:

<img src="@Url.Content("~/Content/Images/leftSpot.jpg")" alt="see properties" />

webforms:

<img src="<%=Url.Content("~/Content/Images/leftSpot.jpg")%>" alt="see properties" />

** EDITED (added webforms answer)


This Works.Tested with my MVC project. Razor Engine.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号