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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:11:56+00:00 2026-06-11T14:11:56+00:00

I have two routes set up in my application: routeCollection.MapRoute(CustomerActivity, Customer/{id}, new { controller

  • 0

I have two routes set up in my application:

routeCollection.MapRoute("CustomerActivity",
                         "Customer/{id}",
                         new { controller = "CustomerActivity", action = "DisplayDetails" },
                         new { id = @"^\d$" });
routeCollection.MapRoute("CustomerSearch",
                         "Customer/{*pathInfo}",
                         new
                            {
                             controller = "CustomerSearch",
                             action = "DisplaySearch"
                            });

Incoming Urls are correctly routed to the right controller/action pairing. However in the view I need to generate an Anchor to view the details of the customer thus:

@Html.ActionLink(Model.Name, "DisplayDetails", "CustomerActivity", new { id = Model.Id }, null)

The problem with this is it doesn’t actually pick any of the routes up; I believe this is because of the constraint on the CustomerActivity route.

I’ve also tried using the RouteLink without much luck:

@Html.RouteLink(Model.Name, "CustomerActivity", new { id = Model.Id })

I can’t take out the constraint on CustomerActivity as this is what stops everything falling into that route.

Adding a copy of CustomerActivity without the constraint to the end seems to resolve the problem, but I’m less than impressed:

routeCollection.MapRoute("CustomerActivity",
                         "Customer/{id}",
                         new { controller = "CustomerActivity", action = "DisplayDetails" },
                         new { id = @"^\d$" });
routeCollection.MapRoute("CustomerSearch",
                         "Customer/{*pathInfo}",
                         new
                            {
                             controller = "CustomerSearch",
                             action = "DisplaySearch"
                            });
routeCollection.MapRoute("CustomerActivityUrlCreation",
                         "Customer/{id}",
                         new { controller = "CustomerActivity", action = "DisplayDetails" });

The only other thing I can think of doing is to radically differentiate the Urls and get rid of the constraint on CustomerActivity, but I’d prefer not to do this. Does anyone else have any other suggestions on how to resolve this?

  • 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-11T14:11:58+00:00Added an answer on June 11, 2026 at 2:11 pm

    This should work. I suspect that your Model.Id is greater than 9 and thus failing your constraint which allows only a single digit. So try adjusting the constraint by allowing multiple digits:

    routes.MapRoute(
        "CustomerActivity",
        "Customer/{id}",
        new { controller = "CustomerActivity", action = "DisplayDetails" },
        new { id = @"^\d+$" }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an action inside my controller class and I want two different routes
I have the following two routes in my app: Router::connect('/posts/:id', array('controller' => 'posts', 'action'
I have two very simple routes routes.MapRoute( post, // Route name postPage + /{slug},
In Rails 3 edge, I have set up two nested resources like this: config/routes.rb
Say I have two routes set up with Flask: app.add_url_rule('/example', view_func = example.Index.as_view('example')) app.add_url_rule('/example/<string:example_key>',
I have this two routes currently in my application after decommenting out many other
I have two tables, one for routes and one for airports. Routes contains just
I have a web site with two routes. Basically the user can do one
I am building an application to find the route between two places.Also, i have
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two

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.