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 361427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:53:25+00:00 2026-05-12T12:53:25+00:00

I am still learning ASP.NET MVC. With webforms, I would create a new folder

  • 0

I am still learning ASP.NET MVC. With webforms, I would create a new folder let’s call it admin. In there I might have many pages for create_product, edit_product, etc. So the URL might look like http://somesite.com/admin/create_product.aspx.

But with MVC it is a little different. I am trying to see what would be the best way to do this.

Would doing http://somesite.com/admin/product/create be right? Or should it just be http://somesite.com/product/create? If I do it as the first way, do I put everything in the “admin” controller or should it be separated into a “product” controller?

I know this is probably subjective or personal choice, but I would like to get some advise.

Thanks.

  • 1 1 Answer
  • 3 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-05-12T12:53:26+00:00Added an answer on May 12, 2026 at 12:53 pm

    Part of the benefit of ASP.NET MVC (and more generally, the URL Routing Engine common to all of ASP.NET in .NET 3.5 SP1) is that the URLs can be flexibly configured to map to any folder / file structure you prefer. That means it’s much easier than it was in the days of WebForms to modify your URLs after you’ve started building your project.

    To your specific questions:

    • One Admin Controller vs. Product Controller – In general, the guidance is to keep controllers focused so that they are easier to test and maintain. For that reason, I would suggest using a single controller per object type (like Product) with your CRUD actions. Examples in your case:

      /admin/product/create

      /admin/product/edit/34 or /admin/product/edit/red-shoes (if name is unique)

      In either case, the Create, Edit, Deatils actions will all be in the ProductController. You may just have custom routes for the “admin actions” (like Create and Edit) that limit their usage (and add the “admin” text to the URL), and then the Details action would be usable by all visitors to your site.

    • Securing Admin Views – One important fact to remember with MVC: all requests go directly to controllers, not views. That means the old “secure a directory with web.config” does not apply (usually) to MVC for securing your Admin. Instead, you should now apply security directly to the controllers. This can easily be achieved by using attributes to Controller classes like:
      • [Authorize] – Just checks that the user is logged-in
      • [Authorize(Roles = “Admin”)] – Limit to specific user roles
      • [Authorize(Users = “Joe”)] – Limit to specific users

    You can even create a custom route for “Admin” views in your site and limit access to those views by enforcing your authorization check in the URL routing, like this:

    routes.MapRoute(
      "Admin",
      "Admin/{controller}/{action}",
      new { controller = "Product", action = "Index" },
      new { authenticated= new AuthenticatedConstraint()}
    );
    

    Where AuthenticatedConstraint looks something like:

    using System.Web;
    using System.Web.Routing;
    public class AuthenticatedConstraint : IRouteConstraint
    {
      public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
      {
        return httpContext.Request.IsAuthenticated;
      }
    }
    

    Good details on Stephen Walther’s blog:
    ASP.NET MVC Tip #30 – Create Custom Route Constraints

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Still learning asp.net and mvc, please be gentle :) Currently setting up an MVC
I am still struggling with learning ASP.NET MVC. All my form entries are required
I'm still learning ASP.NET and I often see code like this throughout parts of
i'm just learning to put in unit testing for my asp.net mvc when i
I am learning ASP.NET MVC and many concepts of ASP.NET like authentication, authorization, session
I been reading on asp.net mvc learning site about JavaScript injection and man it
I am learning ASP.NET MVC. I am following one of the basic tutorials on
I have 3 days to learn the basics of ASP.NET MVC and create a
I'm learning ASP.NET MVC (and MVC in general) and all the help online I
I am learning asp.net mvc and went through a great tutorial that demonstrated it.

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.