You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From @epsitec on Saturday, December 2, 2017 11:46:30 PM
I am using RouteBuilder.MapGet() with this pattern:
address/{zip}/{town}
and I need to be able to pass it a town name which contains a / (such as Belmont/Lausanne) - which is done by using the address/1092/Belmont%2FLausanne. The routing works, however, the route value for town is returned with the string Belmont%2FLausanne.
If I use %25 or other characters which need to be escaped in the URI, they get automatically decoded by the router and returned as their corresponding characters in the route value. The only exception seems to be %2F.
In #363 someone suggested to use a Replace("%2F", "/") but this is just an ugly hack, because it would produce incorrect output for an URI containing %25 followed by 2F ("%252F" should map to "%2F" but with the hack, it would be changed to "/").
@mkArtakMSFT Shouldn't this be considered as a bug that should be fixed? According to the RFC, percent encoding is valid for URI path segments. But when looking at the individual value of a path segment, the URL should probably be decoded.
From @epsitec on Saturday, December 2, 2017 11:46:30 PM
I am using
RouteBuilder.MapGet()
with this pattern:and I need to be able to pass it a town name which contains a
/
(such asBelmont/Lausanne
) - which is done by using theaddress/1092/Belmont%2FLausanne
. The routing works, however, the route value fortown
is returned with the stringBelmont%2FLausanne
.If I use
%25
or other characters which need to be escaped in the URI, they get automatically decoded by the router and returned as their corresponding characters in the route value. The only exception seems to be%2F
.In #363 someone suggested to use a
Replace("%2F", "/")
but this is just an ugly hack, because it would produce incorrect output for an URI containing%25
followed by2F
("%252F"
should map to"%2F"
but with the hack, it would be changed to"/"
).Copied from original issue: aspnet/Routing#502
The text was updated successfully, but these errors were encountered: