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)
: ASP.NET routes incorrectly evaluates constraints when default parameter is sp...
Status: RESOLVED FIXED
Product: Class Libraries
Classification: Mono
Component: Sys.Web
: Trunk
: PC Windows
: --- normal
: ---
Assigned To: Bugzilla
:
:
:
:
  Show dependency treegraph
 
Reported: 2012-11-28 19:41 EST by Pablo Ruiz García
Modified: 2012-12-13 15:06 EST (History)
1 user (show)

See Also:
Tags:
Test Case URL:
External Submit: ---


Attachments

Description Pablo Ruiz García 2012-11-28 19:41:17 EST
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 EST
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 EST
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.