Search code examples
asp.net-mvcurlasp.net-mvc-5area

directly accessing area through url


I'm developing an application using MVC 5. I have added a new area which contains a view called Register and gradually adding content to it. For debugging purposes, I'm trying to access that area directly through url after logging in to application. I'm using the url: http://localhost:port/Area/Account/Manage/Register

But I'm getting error. How will be the url, If need to view Register page directly. Please find the directory structure below:

enter image description here


Solution

  • You cannot access the view file directly. You should access it via an action method.

    Create an action method called Register in your ManageController (if not exists) and return the view

    public ActionResult Register()
    {
      return View();
    }
    

    now you can access this by navigating to yoursitename/account/manage/register assuming you haven't altered the default route registration for the area.