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

  • Home
  • SEARCH
  • 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 6624001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:35:59+00:00 2026-05-25T21:35:59+00:00

How should I configure the following non area routes? /foo/{controller}/{action}/{id} maps to controllers in

  • 0

How should I configure the following non area routes?

/foo/{controller}/{action}/{id}
maps to controllers in namespace myapp.foo.

/{controller}/{action}/{id}
maps to controllers in namespace myapp.

I also have 2 areas, bar and baz, they are registered with registeraAllAreas.

My current setup

This is my current setup. It gives the problem below when I use the url /Home/Index.

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("myapp/elmah.axd/{*pathInfo}");

AreaRegistration.RegisterAllAreas();

routes.MapRoute(
    "foo", // Route name
    "foo/{controller}/{action}/{id}", // URL with parameters
    new { action = "Index", id = UrlParameter.Optional }, // Parameter defaults
    new string[] { "myapp.Controllers.foo" }
);

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

Multiple types were found that match the controller named ‘Menu’. This
can happen if the route that services this request
(‘foo/{controller}/{action}/{id}’) does not specify namespaces to
search for a controller that matches the request.

The request for ‘Menu’ has found the following matching controllers:
myapp.Controllers.MenuController
myapp.Areas.bar.Controllers.MenuController
myapp.Areas.baz.Controllers.MenuController

Clearly there’s something I’m doing the wrong way.

Update

I also get the wrong adress generated when I use:

<% using (Ajax.BeginForm("SaveSomething", "Home", ...

It renders <form target="/foo/Home/SaveSomething"

I’m guessing that one cannot reliably use {controller} in two routes in the same area.

Update 2

It seems to work much better when I put the /foo route registration at the bottom.
This raises the question, what is considered a/the default route? (As the default route is reccomended to be put at the very end.)

  • 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-25T21:35:59+00:00Added an answer on May 25, 2026 at 9:35 pm

    You have two controllers that has the name MenuController so MVC doesn’t know which one to use if you don’t give it more information. In you areas you probably have a files named something like <YourAreaName>AreaRegistration. Open those files and update the RegisterArea method so you route the request to the right controller.

    From your error message it seems like the route is getting mapped to foo/{controller}/{action}/{id}, which doesn’t have a MenuController. My guess is that you have a action link on a page under foo something something. That will generate an incorrect link if you don’t specify the area for the link.

    Try this to use the default route with ActionLink:

    @Html.ActionLink("Some text", "action", "controller", new { area = "" }, null)
    

    If you want the request to go to a specific area just write it down in the call.

    UPDATE: The problem is that when you write something like Ajax.BeginForm("SaveSomething", "Home",...) it will match the first route. You can’t solve this by putting the area in the BeginForm statement as I suggested before since the foo route is not an area. You have two options, 1: move the foo part to an area, 2: put the foo route after the default route. If you put the default route before the foo route you will get a hard time rendering urls as long as you have foo in the same area as the default route (the default area), since the route engine will always find the default one first. However, you will be able to catch request to the foo route. So my best suggestion is to put the foo route in an area.

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

Sidebar

Related Questions

Which property should I change on Info.plist in order to configure the list of
In the forge documentation it states: You should now be able to configure the
For a product system that has prompts to configure the IP/netmask, should 0.0.0.0 etc
Should createUrl be called on controller or in views ? It doesn't matter? Or
Should I constantly have a session open in my web site with user accounts,
I'm trying to configure an Apache webserver to work the following way: if /specialdir/
IIS enables us to also configure Asp.Net file mappings. Thus besides aspx, IIS also
I was following the tutorial on how to configure Pentaho to use mysql databases
Using C#4.0 Following on from my question How to configure nHibernate for many-many mapping?
I have the following code in an Autofac Module that is used in my

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.