2
votes

I tried to change my default route template:

  • {controller=Home}/{action=About}/{id?}

But when I start my project (without any url path - just: http://localhost:49406/) it always loads the Index instead of the About. I have no other routes and I don't use attribute routing at all.

I also tried to change the default controller:

  • {controller=Main}/{action=Index}/{id?}

It loads the HomeController's Index instead of the MainController's Index.

Is it a bug or I forgot something?

1
Please share the actual source codeuser1023602
Is just the default ASP.NET Core Web Application (.NET Core) > Web Application project within Visual Studio 2017 Community. I didn't change anything except the route template in the Startup.cs. Which part of this large project template should I share?ggabor
Yes, can you please share route template code block from Startup and MainController?Sanket

1 Answers

1
votes

If you are not using any attribute routing at all the problem should come from your Startup.cs file.

Make sure that you are calling app.UseMvc()only and not app.UseMvcWithDefaultRoute() in Configure method.