A388

Preventing Browser Requests for favicon.ico

In my Arex388.AspNetCore NuGet package I have an AntiFavicon middleware that would intercept requests to /favicon.ico and return a 404 early in the request processing pipeline. At some point I forgot about it and in one of my bigger projects I implemented a different fix that I found on this StackOverflow question.

It is a much better approach than my middleware because it stops the browser from making the request from the very beginning. All you have to do is add this link element to the head element:

<link rel="icon" href="data:;base64,iVBORw0KGgo=" type="image/png" />

I'm going to remove my interception middleware since this is the better approach. Thank you Diego Perini for providing this solution!

View or Start a DISQUS Thread