Bug 5283 - RouteCollection behavior differs from Microsoft .NET
Summary: RouteCollection behavior differs from Microsoft .NET
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web ()
Version: 2.10.x
Hardware: PC Windows
: --- normal
Target Milestone: Community
Assignee: Bugzilla
Depends on:
Reported: 2012-05-23 14:16 UTC by Michiel Overeem
Modified: 2016-11-10 13:18 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 5283 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Michiel Overeem 2012-05-23 14:16:50 UTC
The behavior of the RouteCollection differs from Microsoft's implementation. Causing URL's to be catched by the wrong handler.

Problem 1. The RouteCollection.Ignore method.

Example code:

private static void RegisterRoutes(RouteCollection routes) 

  // other routes

On Microsoft .NET this rule causes url's like 
to be ignored. On mono however, these url's are not ignored.

Changing the Ignore rule to
  routes.Ignore("{*allcommand}", new { allcommand = @".*\.command(/.*)?" });
causes it to work correctly.

Problem 2. The catch all route.

Example code:

private static void RegisterRoutes(RouteCollection routes) 
  routes.Add(new Route("{*path}", new HttpHandlerRouteHandler<SomeType>());

  // other routes

On Microsoft .NET this route catches
http://somedomain.com/ and http://somedomain.com/Home

On Mono however, I need to add the following rule to catch the first url:
  routes.Add(new Route("", new HttpHandlerRouteHandler<SomeType>());
Comment 1 Daniel Lo Nigro 2013-05-31 07:09:27 UTC
Are you still encountering this issue?
Comment 2 Michiel Overeem 2013-08-08 05:53:11 UTC
The differences between Mono and Microsofts implementation are still there.

But not all...

1) the route 
> routes.Ignore("{fileName}.command/{*pathInfo}");

now works the same on Mono and Microsoft

2) the route 
> routes.Add(new Route("{*path}", new HttpHandlerRouteHandler<SomeType>());

Still needs
> routes.Add(new Route("{}", new HttpHandlerRouteHandler<SomeType>());
on Mono

3) the route
>  routes.Ignore("Part/{*pathInfo}");
catches http://example.com/Part?arg=value with Microsofts implementation. On Mono however, those URL's are not catched.
Comment 3 Michiel Overeem 2013-08-08 06:02:13 UTC
This is all tested on Mono 3.2.1(MacOSX)