asp.net routing cannot find method -


I have a folder crated in my application called Admin in the controller, so my folder structure looks like this

  - Models | -Views | -Controller | | - Main Controller Bracket | | -Admin | | -HomeController CS & lt; - In this controller, I need to prepare a method so that I will execute the home controller's add-url url  http: // , but I Receives a 404 error. 

  Public static zero registerrates {routes.IgnoreRoute ("{} resource .axd / {* pathInfo}"); Route. MapRout (name: "admin", url: "admin / {controller} / {action} / id}", default: new {controller = "home", action = "index", id = url parameter. Option}, namespace : New [] {"fms.Controllers.Admin"}); Routes New {controller = "home", action = "index", id = UrlParameter.Optional} with MapRoute ("default", // root name "{administrator} / {action} / {id}", // URL parameter // parameter defaults); }   

Your administrator route specifies a route like this:

  Admin / {controller} / {action} / {id}  

This means you need the name of the controller as well as the action in your URL. For example, this should work:

  http: // localhost: 2336 / admin / home / add  

if you change it by url route Will work:

  admin / {action} / {id}  

However, this means that it has to be kept with its own controller controller It's useless to have folders. If I were you, how would I make a new MVC area?


Comments