Getting error 404 not found with ASP.NET MVC Area routing

前端 未结 4 738
春和景丽
春和景丽 2021-01-02 06:46

I am having a problem with an Area route in MVC 5. When I browse to /Evernote/EvernoteAuth I get a 404 resource cannot be found error.

My area looks like this:

4条回答
  •  半阙折子戏
    2021-01-02 07:18

    It is important tha you add the correct namespace to your controller

      namespace YourDefaultNamespace.Areas.Evernote.Controllers
      {
        public class EvernoteAuthController : Controller
        { 
            ...
            ...
        }
      }
    

    So the routing can find your controller. Now you have to register the area in the Global.asax.cs with the method

    AreaRegistration.RegisterAllAreas();
    

提交回复
热议问题