Kulpemovitz
Kulpemovitz

Reputation: 541

MVC 3 - _Layout.cshtml. Add a logo to the site

I'm new to MVC 3, I'm trying to add an Image to the _Layout.cshtml file. I tried

<img runat="server" id="img_logo" alt="Logo" src="Content/Images/mailworks.png" />

no success. The logo only appear on some views. on others views for some reason the image is supposed to be in some other location - found it using firebug.

Upvotes: 7

Views: 35837

Answers (3)

Aminos
Aminos

Reputation: 871

I found another quick solution : just append '/' at the beginning of the src's path.

Upvotes: 0

serge.karalenka
serge.karalenka

Reputation: 990

Use this:

<img src="@Url.Content("~/Content/Images/mailworks.png")"...

Upvotes: 4

Aleksei Pugachev
Aleksei Pugachev

Reputation: 286

Try this:

<img id="img_logo" alt="Logo" src="@Url.Content("~/Content/Images/mailworks.png")" />

Upvotes: 21

Related Questions