Bug 8646 - ASP.NET routes incorrectly evaluates constraints when default parameter is specified for such constraint. (which is incosistent with how this works on MS.NET)
Summary: ASP.NET routes incorrectly evaluates constraints when default parameter is sp...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web ()
Version: master
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-11-28 19:41 UTC by Pablo Ruiz García
Modified: 2012-12-13 15:06 UTC (History)
1 user (show)

Tags:
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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Pablo Ruiz García 2012-11-28 19:41:17 UTC
Hello,

This is just a marker bug created so I can obtain a bug number for my pull-request, however the following explanation (which I will briefly include on pull-request's comment) maith be usefull in the future as reference.

I've found a couple of inconsistencies with MS.NET on Sys.Web.Routing inside Url Generation logic:

A route table like the following:

                        routes.Add(new MyRoute("login", new MyRouteHandler())
                        {
                                Defaults = new RouteValueDictionary(new { controller = "Home", action = "LogOn" }),
                        });

                        routes.Add(new MyRoute("{site}/{controller}/{action}", new MyRouteHandler())
                        {
                                Defaults = new RouteValueDictionary(new { site = "_", controller = "Home", action = "Index" }),
                                Constraints = new RouteValueDictionary( new { site = "_?[0-9A-Za-z-]*" })
                        });

                        routes.Add(new MyRoute("{*path}", new MyRouteHandler())
                        {
                                Defaults = new RouteValueDictionary(new { controller = "Error", action = "NotFound" }),
                        });

On MS.NET using the following route values:

                        var rvs = new RouteValueDictionary()
                        {
                                { "controller", "Home" },
                                { "action" , "Index" }
                        };

Will match the route "{site}/{controller}/{action}" and built it using '_' as "site" parameter, as this is it's default value.

However, on our (mono) side RouteCollection states that no route matched our request...
Comment 1 Pablo Ruiz García 2012-11-28 20:00:06 UTC
Just sent the pull-request: https://github.com/mono/mono/pull/515

Greets
Comment 2 Pablo Ruiz García 2012-12-13 15:06:19 UTC
I'm closing this as Marek kindly applied the pull-request to master.

https://github.com/mono/mono/commit/084915587a20a1407424bbefbf7ed203277c9ed4

That's all folks.. ;)