Bug 17960 - [Routing] Paths with wildcard not built correctly
Summary: [Routing] Paths with wildcard not built correctly
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web ()
Version: 3.2.x
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-02-23 19:21 UTC by Daniel Lo Nigro
Modified: 2014-03-11 00:57 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 Daniel Lo Nigro 2014-02-23 19:21:31 UTC
To reproduce (with ASP.NET MVC 4):

Route:
routes.MapRoute(
	name: "HelloWorld",
	url: "HelloWorld/{*path}",
	defaults: new { controller = "HelloWorld", action = "Index" }
);

Controller:
public class HelloWorldController : Controller
{
	public ActionResult Index(string path)
	{
		var url = Url.Action("Index", "HelloWorld", new { path = "foobar" });
		return Content(string.Format("Path = {0}, sample URL = {1}", path, url));
	}
}

Go to these URLs:
http://localhost:8080/HelloWorld
http://localhost:8080/HelloWorld/asdf
http://localhost:8080/HelloWorld/asdf/qwerty

Expected output:
Path = , sample URL = /HelloWorld/foobar
Path = asdf, sample URL = /HelloWorld/foobar
Path = asdf/qwerty, sample URL = /HelloWorld/foobar

Actual output:
Path = , sample URL = /HelloWorld
Path = asdf, sample URL = /HelloWorld
Path = asdf/qwerty, sample URL = /HelloWorld

Notice that the parameters are being matched correctly, but the routes built by Url.Action are incorrect
Comment 1 Daniel Lo Nigro 2014-02-24 01:28:58 UTC
Pull request submitted: https://github.com/mono/mono/pull/911
Comment 2 Daniel Lo Nigro 2014-03-11 00:57:17 UTC
Patch merged.