1

We are in the progress of immigrate our existing web solution from .net to .net core, in this progress we have meet some challenges. We have all our modules in Area's and one of the Area must be used as default. In this case it's Area "Viggo".

Atm we got it working on this url:

"https://localhost:44315/Viggo/Account"

what we want is it to respond on this url instead:

"https://localhost:44315/Account"

The routing we are using right now is this:

app.UseMvc(routes =>
            {
                routes.MapAreaRoute(
                    name: "AdministratorArea",
                    areaName: "Administator",
                    template: "Administator/{controller=Home}/{action=Index}/{id?}");

                routes.MapRoute(
                    name: "default",
                    template: "{area=Viggo}/{controller=Home}/{action=Index}/{id?}");
            });
  • You need to use `MapAreaRoute` to specify that `"/Account"` should map to `Viggo/Acount` and generally redirect calls to areas that don't match a template. [For normal cases](https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/areas?view=aspnetcore-2.2#add-area-route) you should use `{area:exists}` with MapRoute. – Panagiotis Kanavos Mar 08 '19 at 11:56

0 Answers0