Bug 4896 - Incorrect routing of catchall parameter
Summary: Incorrect routing of catchall parameter
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: 2.10.x
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-05-04 18:22 UTC by Bassam
Modified: 2016-11-11 09:42 UTC (History)
3 users (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 for Bug 4896 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:
Status:
NEW

Description Bassam 2012-05-04 18:22:21 UTC
System.Web.Routing does not seem to parse the catchall parameter correctly. Below is a repro:

using System;
using System.Collections.Specialized;
using System.Web;
using System.Web.Routing;

namespace MonoRoutingBug
{
    class Program
    {
        static void Main(string[] args)
        {
            Route route = new Route("api/v{version}/folder/{folderId}/search/{*relativePath}", new RouteValueDictionary(new { controller = "Foo", action = "Index" }), new DummyRouteHandler());
            RouteData data = route.GetRouteData(new DummyHttpContext("/api/v0/folder/2793d936b47c4a73b97d01fea321db3a/search/"));
            Console.WriteLine("{0}", data == null);
            // Expected : data is not null
            // Actual: data is null
        }
    }

    class DummyRouteHandler : IRouteHandler
    {
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            return null;
        }
    }

    class DummyHttpRequest: HttpRequestBase
    {
        private Uri url;

        public DummyHttpRequest(string urlString)
        {
            url = new Uri(new Uri("http://localhost"), urlString);
        }

        public override string AppRelativeCurrentExecutionFilePath { get {
return "~" + url.LocalPath; } }
        public override string PathInfo { get { return string.Empty; } }
        public override NameValueCollection QueryString { get { return
HttpUtility.ParseQueryString(url.Query); } }
    }

    class DummyHttpContext : HttpContextBase
    {
        private DummyHttpRequest req;

        public DummyHttpContext(string urlString)
        {
            req = new DummyHttpRequest(urlString);
        }

        public override HttpRequestBase Request { get { return req; } }
    }
}
Comment 1 michael 2012-09-26 13:02:48 UTC
This was fixed in 65f7b4a137cc45d8c666669a9343953f5f415aa4 in the mono-2-10 branch.