Asp.net Mvc: why is browser looking for favicon.ico

后端 未结 4 2107
面向向阳花
面向向阳花 2021-02-13 17:54

I know there is a solution to stop the mvc framework to process \"favicon.ico\" requests (solution), but i don\'t know why is it looking for this icon in the first place.

<
4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-13 18:25

    You better have one since it is standard to most browsers to look for the favicon.ico however if you really don't want to have it and get rid of the error just add this line in your RegisterRoutes class.

    routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
    

提交回复
热议问题