Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting ASP.NET Core 2.0 favicon

I'm trying to add and set favicon.ico.

When I saw a initial project that Visual Studio 2017 make automatically, the favicon.ico file is just in the wwwroot directory and there is no setting for it.

So, I add favicon file into wwwroot directory. But the favicon does not show up in any browsers.

How can I set the favicon in ASP.NET Core 2.0?

like image 848
wallah Avatar asked Feb 19 '18 03:02

wallah


People also ask

How do I change the favicon in .NET core?

tag in your html or cshtml. For me, adding favicon. ico to wwwroot folder and pressing CTRL + F5 on my browser cleared the cache and made the new icon show up.

What is favicon ICO in asp net?

A favicon is the little image displayed at the left edge of the address bar in most browsers, or on the tab. A favicon is the little image displayed at the left edge of the address bar in most browsers, or on the tab. Adding a Favicon is a nice way to enhance your website and give it a finished look.

What size should a favicon be 2021?

The standard size for favicons is 16x16 pixels, but most designers start with 32x32 pixels to accommodate retina screens. This way, the larger favicons show up nicely on retina screens and can also be scaled down.


1 Answers

wwwroot/index.html file has the link to favicon.

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

is the code to add favicon to the website.

For .net core Single Page Application (SPA) project the favicon will be rendered from its own respective static file. For example if are using angular as client application there is index.html file inside src and in index.html you can link your favicon with following code

<link rel="icon" type="image/x-icon" href="favicon.ico">
like image 65
Kiran Shahi Avatar answered Nov 08 '22 23:11

Kiran Shahi