bpardo
bpardo

Reputation: 411

Asp.Net MVC 5 - Favicon

I Search this Question for all sites, but the examples don't work. I have this code in the section, but it isn't working.

<link rel="icon" href="@Url.Content("../Images/favicon.ico")" type="image/x-icon" />
<link rel="shortcut icon" href="@Url.Content("../Images/favicon.ico")" type="image/x-icon" />

Any suggestions?! Thank you!

Upvotes: 2

Views: 8000

Answers (2)

iAM
iAM

Reputation: 1385

I came across this problem and I thought even if the question is old, I should share how i solved it. I hope it will help someone else.

The quick fix:
Delete the favicon.ico that came with the mvc 5 template and replace it with custom icon (which has to be renamed to favicon.ico.) The reason for rename is, by convention browsers looks for favicon at the root of the application.

Another way:
Add a link inside head tag of your html page.

 <link rel="shortcut icon" type="image/ico"  href="@Url.Content("~/favicon.ico")">

Upvotes: 3

Shian JA
Shian JA

Reputation: 814

You can directly Give the Path like:-

<link rel="icon" href="~/Images/favicon.ico" type="image/x-icon" />

Upvotes: 0

Related Questions