mercredi 29 mars 2017

images not showing because relative path is not being converted to physical ASP MVC

I am storing image's relative path in my db and then when retrieved I passes it to my view via Model Binding method. When I am setting img's path to the path coming from db that relative path shows as it is in the html page instead of being converted into physical path. How can I force it to be converted to physical?

I tried Server.MapPath() in view but that doesn't help.

I wrote:

<img src=@Model.imgPath>

which is rendered as:

<img src="~/images/img.png">

in my browser.

Aucun commentaire:

Enregistrer un commentaire