Bug 8646

Summary: ASP.NET routes incorrectly evaluates constraints when default parameter is specified for such constraint. (which is incosistent with how this works on MS.NET)
Product: [Mono] Class Libraries Reporter: Pablo Ruiz García <pablo.ruiz>
Component: System.WebAssignee: Bugzilla <bugzilla>
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: master   
Target Milestone: Untriaged   
Hardware: PC   
OS: Windows   
Tags: Is this bug a regression?: ---
Last known good build:

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

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

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.


That's all folks.. ;)