This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
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: Sys.Web (show other bugs)
Version: Trunk
Hardware: PC Windows
: --- normal
Target Milestone: ---
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)

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


Attachments

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.. ;)

Note You need to log in before you can comment on or make changes to this bug.