Blazor routing in .NET 8 interpreting %2f as / #53622
Replies: 2 comments
-
convert the encoded string to its original form |
Beta Was this translation helpful? Give feedback.
0 replies
-
Moved to #53668 for triage. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all, I realise using an encoded forward slash (%2f) in a URL is not advised, however we have a website that uses the 'code' for a record in the URL. A code could be ABC/123. We then use it in the URL to determine what data to display on a generic page, e.g. /somepage/ABC%2f123
This used to work fine, as in the routing would go to the Blazor page with the
@page
directive "/somepage/{code}. But now, after upgrading the project to .NET 8, this url - /somepage/ABC%2f123 - experiences a page not found error, as it is interpreted by the Blazor routing engine as /somepage/ABC/123, which would be looking for a Blazor page with the@page
directive matching "/somepage/{param1}/{param2}", which doesn't exist.The robust solution would be to change the page to not use the 'code' in the URL, to completely avoid forward slashes. However, this page has worked for a couple of years like this without issue and is now impacting production, so I'm looking for a quick fix. Does anyone know of a setting, or some config that was changed/introduced somwhere in .NET8 that would influence routing?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions