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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:27:46+00:00 2026-05-27T20:27:46+00:00

I have 2 routes mapped in my mapping… this is to allow a user

  • 0

I have 2 routes mapped in my mapping…

this is to allow a user to type in the url with an optional parameter to quick load their town in the home page of the website, example:

http://www.mysite.com/manchester
http://www.mysite.com/liverpool

or to simply go to the defaul home page if http://www.mysite.com is entered with nothing else.

With the default mapping in place to handle the controller/action/parameter i have added an additional route so the parameter is handed:

routes.MapRoute(
    "Default", // Route name
    "{controller}/{action}/{id}", // URL with parameters
    new { controller = "Home", action = "Index", id = UrlParameter.Optional }); // Parameter defaults

routes.MapRoute(
    "HomePageQuickFind",
    "{quickFind}",
     new { controller = "Home", action = "Index", quickFind = UrlParameter.Optional });

I am not very good with route mapping as I am struggling to understand it and my question is this a bad approach which my cause “greedy routing” and is there another way of implementing my scenario?

  • 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-05-27T20:27:47+00:00Added an answer on May 27, 2026 at 8:27 pm

    I think you need to replace the default route with a set of routes for each of your controllers, then add your quick find route as the last route. This should allow any unmatched routes to fall through to the quick find route. Try something like this:

    // Routes for standard controllers
    routes.MapRoute(
        "Home",
        "home/{action}/{id}",
        new { controller = "home", action = "index", id = UrlParameter.Optional }
    );
    routes.MapRoute(
        "Map",
        "map/{action}/{id}",
        new { controller = "map", action = "index", id = UrlParameter.Optional }
    );
    routes.MapRoute(
        "Default",
        "users/{action}/{id}",
        new { controller = "users", action = "index", id = UrlParameter.Optional }
    );
    
    // Route for www.mysite.com/cityname
    routes.MapRoute(
        "QuickFind",
        "{quickFind}",
        new { controller = "home", action = "index", quickFind = UrlParameter.Optional }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this route mapped: routes.MapRoute( Solutions, {lang}/Solutions/{controller}/{action}, new { lang=en-US, controller =
I have a a userPanel method mapped to the /user/panel URL route: @RequestMapping(value =
ok i got this problem. i have this routes: (code bit change) File:/home/dotcloud/current/config/routes.js exports.routes
In my routes I have: resources :accounts This produces: accounts GET /accounts(.:format) accounts#index POST
I have the following route: routes.MapRoute( Default, // Route name {controller}/{action}/{id}, // URL with
I have a route which routes a request to somepath/:id(.:format) to somecontroller#show . This
I have a route (which works): routes.MapRoute( Details, // Route name {controller}/{id}, // URL
ASP.NET MVC routes have names when mapped: routes.MapRoute( Debug, // Route name -- how
I would like to change my default route values. Right now, I have: routes.MapRoute(
In routes.rb, I have: [some routes] match '/me' => scores#all_athlete_scores, :constraints => LoggedInChecker devise_scope

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.