Viresh
Viresh

Reputation: 323

Image path showing wrong when run from iis

I am new to mvc. I have created one web application in .

src="../../images/1.jpg"

This is working when I debug from project but it is not loading from iis. Can anybody help me?

Upvotes: 0

Views: 1198

Answers (2)

Viresh
Viresh

Reputation: 323

<img alt="Picture Display" src="<%= Url.Content("~/images/1.jpg")" />

this solved my problem

Upvotes: 0

Satpal
Satpal

Reputation: 133403

I will suggest you to use UrlHelper.Content Method, It converts a virtual (relative) path to an application absolute path.

Example

@Url.Content("~/images/1.jpg")

Here The ~ character matches the root of the site /.

Upvotes: 1

Related Questions