Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8205609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:18:50+00:00 2026-06-07T08:18:50+00:00

I am making Areas for User, Admin, Shop, Forum… etc In each area, it

  • 0

I am making Areas for User, Admin, Shop, Forum… etc

In each area, it has its own Controllers, Models, Views folders. At the root Models, root Controllers and root Views I have shared components in them.

Structure A:

Root/ -> Models/, Controllers/, Views/
Root/User/ -> Models/, Controllers/, Views/
Root/Admin/ -> Models/, Controllers/, Views/
Root/Shop/ -> Models/, Controllers/, Views/
Root/Forum/ -> Models/, Controllers/, Views/

I maybe wrong, but they really don’t look DRY to me to repeat M V and C folders in each of the business logic groups. I was thinking a better structure would be using M V and C as the main folders and layout my business logic groups in them:

Structure B:

Root/Views/ -> User/, Admin/, Shop/, Forum/ ...etc
Root/Models/ -> User/, Admin/, Shop/, Forum/ ...etc
Root/Controllers/ -> User/, Admin/, Shop/, Forum/ ...etc

But if I do structure the folders this way, I lost the area (or from users point of view, the sub folder path) ability to divde logical functionalities of the website.

e.g.

with structure A, I can do:

www.mywebsite.com/Users(area)/Account(controller)/LogOn(action)
www.mywebsite.com/Admin(area)/Account(controller)/LogOn(action) 

Notice I can have same controller and action names with different areas.

With structure B, best I can do is:

www.mywebsite.com/AdminAccount(controller)/LogOn(action)
www.mywebsite.com/UserAccount(controller)/LogOn(action)

It can not achieve the single-word sub-folder result without area. If not only that, the controller names here can get longer and more messy very soon. Not to mention you have a large group of actions stacking in same controller.cs file.

So, anyway, my point is, if I find Structure B making more sense to me, how do I go about configuring routing to achieve that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:18:51+00:00Added an answer on June 7, 2026 at 8:18 am

    So you want Structure B with url’s corresponding to A?

    You’ll be giving up convention over configuration.

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
            routes.MapRoute(
                "UserAccount", // Route name
                "users/account/{action}/{id}", // URL with parameters
                new { controller = "UserAccount", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
    
            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }
    

    Another option would be to write a custom route handler and introduce your own convention. Something like the following (new convention would be to concatenate Users and Account to get the UsersAccountController in http://www.mywebsite.com/Users/Account/LogOn). I did not test to see how this handles areas, but if you have issues let me know and I can take a look.

    public class CustomConventionRouteHandler : MvcRouteHandler
    {
        protected override IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestContext)
        {
            string controller = requestContext.RouteData.Values["controller"].ToString();
    
            object controllerModifier;
            if (requestContext.RouteData.Values.TryGetValue("controllerModifier", out controllerModifier))
            {
                requestContext.RouteData.Values["controller"] = string.Concat(controllerModifier, controller);
            }
    
            return base.GetHttpHandler(requestContext);
        }
    }
    
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
        routes.Add(
            new Route(
                "{controllerModifier}/{controller}/{action}",
                new RouteValueDictionary(new { controllerModifier = UrlParameter.Optional, controller = "Home", action = "Index" }),  //defaults
                new CustomConventionRouteHandler()));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a text editor using Text Area. Which user can change font size,
I have a user login/reg system with a user management admin area. Just some
A Brief Background I'm making a conventional forum to learn/practice Rails. User Model has_many
I am making a UI in WPF, I have a bunch of functional areas
I'm making a custom component that shows a little drop down area after you
Or: How to expand the sensitive area for a UIControl without just making the
Making a simple application, so when the user logs out of Windows, it of
I need help on making the touched areas of bitmap image transparent(seems like erasing)
I am making a website and I want to use the following design: Each
I am making an application that connects to our billing software using its API,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.