Previously, one would add something like this to Global.aspx.cs
, which is gone in .NET Core:
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
Here's what I currently have in my Startup.cs
(for .NET Core):
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
routes.MapSpaFallbackRoute(
name: "spa-fallback",
defaults: new { controller = "Home", action = "Index" });
});
The problem is that in MVC (pre-Core) routes
was a RouteCollection
and in .NET Core it's a Microsoft.AspNetCore.Routing.IRouteBuilder
so IgnoreRoute
is not a valid method.