MVC 3 - _Layout.cshtml. Add 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 is displayed only on some types. on other views, for some reason, the image should be in some other place - it was detected using firebug.

+6
source share
2 answers

Try the following:

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

Use this:

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

Source: https://habr.com/ru/post/915969/


All Articles