namespace for the route rule

Dec 14, 2012 at 6:14 AM

Hi,

is there no way to set controllers namespace for route?

i have two controllers with the same name in the different areas, and I have got exception with the message "Multiple types were found that match the controller named".

Coordinator
Dec 14, 2012 at 5:03 PM

There is now.

I was able to reproduce your issue by including two controllers with the same name in two different namespaces.

To resolve it, I've now (release 1.0.2, rev. 81746) added a <namespaces> element as a possible child element of the Mvc route.

For example:

<routes>
  <add type="Mvc" name="Default" url="mvc/{controller}/{action}/{id}">
    <defaults controller="Home" action="Index" id="" />
    <namespaces>
      <add namespace="Sample.Controllers"/>
    </namespaces>
  </add>
</routes>