Using Url.Content with semi-relative URL

后端 未结 2 1224
情深已故
情深已故 2020-12-31 02:54

I am storing the location of images in my database in an MVC application...but i am only storing part of the location. For example:

/headers/image1.jpg
/head         


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-31 03:09

    You can write extension method which combine your ImageUrl with configured path to content directory.

    @Model.ImageAlt
    

    PS
    Remember about alt tag. ;)

提交回复
热议问题