2

I am trying to add a area to my application but it throws the below error at

context.MapRoute

I have system.web and system.web.mvc dlls referred in my application. What may be the issue?

My application is targeting .Net core 2.0

Any pointers please?

error info

Kurkula
  • 6,386
  • 27
  • 127
  • 202

1 Answers1

2

If you're targeting your projecto to .Net core 2.0 and it's a ASP.NET Core, than you should follow these instructions on microsoft docs. You don't need those references to System.Web.

You can do area registration with MapRoute in your startup class for example, and the folder/file structure will do the rest:

...
   app.UseMvc(routes =>
   {
     routes.MapRoute(
         name: "areaRoute",
         template: "{area:exists}/{controller=Home}/{action=Index}/{id?}");

     routes.MapRoute(
         name: "default",
         template: "{controller=Home}/{action=Index}/{id?}");
   });
Luís Antunes
  • 326
  • 2
  • 9