asp.net mvc - Custom "subdirectory" URLs by using MVC Routes in MVC4 -


I am working on an MVC4 project, but I like custom routing that says I have the following page structure

(Preferred URL: / Settings / Email) - SMS (desired URL: / settings / sms) - Notifications (desired) Url: / settings / notification)

is the controller, model and view of each page, as set Some of the GSA pages are quite complex. How do I get the desired url through routing?

So far I have been able to appear under Everything under / settings / {PageName} , in which Home Page, which is clearly not good

I have seen and searched online but I am not getting a clear example of how to achieve something like this when all of the pages There are different controllers.

How can this be done? Thank you.

You have to use strict coded routes like this. Is there any reason that you are using different controllers for each page?

  routes.MapRoute (name: "home", url: "home", default: new {controller = "home" action = "index"}); Routes.MapRoute (name: "settings", url: "settings", default: new {controller = "settings", action = "index"}); Routes.MapRoute (name: "email", url: "/ settings / email", default: new {controller = "email", action = "index"});  

Comments

Popular posts from this blog

scala - Play Framework - how to bind form to a session field -

c++ - Why does Visual Studio Release build break on non-executing code line -

Firefox reacting to JQuery setTimeout that doesn't apply -