Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.
This repository was archived by the owner on Nov 27, 2018. It is now read-only.

Slashes incorrectly encoded when building URL with catchall param? #363

Closed
@Daniel15

Description

@Daniel15

Consider this controller:

public class TestController : Controller
{
  [Route("foo/{*path}")]
  public IActionResult Index(string path)
  {
    var url = Url.Action("Index", new { path = "hello/world" });
    return Content("Path = [" + path + "], built URL = " + url);
  }
}

When you hit http://example.com/foo/some/url, ASP.NET MVC Core will display:

Path = [some/url], built URL = /foo/hello%2Fworld

Whereas ASP.NET MVC 5 will display:

Path = [some/url], built URL = /foo/hello/world

Notice that the URL returned by Url.Action encodes / as %2F, whereas the previous MVC version did not do this.

Is this an expected change? If so, how do I render the URL such that the slash is not encoded?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions