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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:46:27+00:00 2026-06-07T17:46:27+00:00

I’ve read through a number of these questions about Asp.net MVC and directory structures,

  • 0

I’ve read through a number of these questions about Asp.net MVC and directory structures, but I still don’t understand how to immitate regular URL directories such as http://www.mysite.com/books/adventure/uk

And, when you think of standard site pages like Home, About, Contact Us, etc. You wouldn’t want to create a Controller for each, but you also don’t want to the Urls to look like this:
http://www.mysite.com/home/about
You would preferably want it to be http://www.mysite.com/about

Anyone have a good enough understanding of the maproute object to help me understand this?

Thanks,
Jacques

  • 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-07T17:46:28+00:00Added an answer on June 7, 2026 at 5:46 pm

    This is fully customizable in the global.asax.cs

    By default, a new MVC project adds the standard ‘catchall’ route which follows the convention: www.mysite.com/Controller/Action/ID

    If you want something different, such as your example of http://www.mysite.com/about routing to HomeController.About() action, you would add the following route before the catchall one:

    routes.MapRoute(
        "My About Route",
        "About",
        new { controller = "Home", action = "About" }
    );
    

    You can add any number of custom routes that don’t follow the MVC catchall convention, and can even replace the catchall route altogether if you desire.


    EDIT:

    To answer your comment below, no you don’t necessarily need to add a route for every possible action, instead you can make a single route that fits a pattern of url’s – just like the catchall one is doing. {controller} and {action} are special keywords.

    Examples:

    1.) Program has a SetController, but user’s are accustomed to calling them Batches:

    routes.MapRoute(
        "Batch",
        "Batch/{action}/{id}",
        new { controller = "Set", action = "Index", id = UrlParameter.Optional }
    );
    

    2.) You prefer to group by the type of objects for the Controller, but have the url’s be a verb/noun format:

    • FlightController
    • HotelController
    • /find/flight /book/flight
    • /find/hotel /reserve/hotel/Hilton

    routes.MapRoute(
        "NewCatchall",
        "{action}/{controller}/{name}",
        new { controller = "Home", action = "Index", name = UrlParameter.Optional }
    );
    

    The second example can replace the default route altogether, and all possible url’s would fit its format. So nothing would continue on to check any other routes. It’s important to know that routes are checked in order, and the first pattern that matches the request is used – the rest ignored.

    These were useful to me when learning:

    • http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx
    • http://www.asp.net/mvc/tutorials/older-versions/controllers-and-routing/asp-net-mvc-routing-overview-cs
    • http://blogs.msdn.com/b/tmarq/archive/2010/04/01/asp-net-4-0-enables-routing-of-extensionless-urls-without-impacting-static-requests.aspx
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't have much knowledge about the IPv6 protocol, so sorry if the question
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I want to construct a data frame in an Rcpp function, but when I

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.