Blazor路由中的多个查询字符串参数 [英] Multiple query string parameters in Blazor routing
问题描述
我当前的项目中有多个工作示例,这些示例从url检索1个查询参数,但是当尝试对多个url参数遵循相同的约定时,我在chrome调试器控制台中收到以下错误:
I have multiple working examples in my current project of retrieving 1 query parameter from the url however when trying to follow the same convention for multiple url params, I'm receiving the following error in the chrome debugger console:
Error: System.InvalidOperationException: 'Router' cannot find any component with a route for '/confirmemail'.
我的页面路线定义为:
@page "/confirmemail/{Token}/{UserId}"
和 @functions {...}
部分包含以下属性:
[Parameter]
string Token { get; set; }
[Parameter]
string UserId { get; set; }
我正在尝试检索如下所示网址的查询字符串参数:
I am trying to retrieve the query string parameters for a url that looks like this:
http:// localhost:50466 / confirmemail?Token = SomeReallyLargeToken& UserId = SomeGuidUserId
如何实现?
推荐答案
您可以尝试吗?
http://localhost:50466/confirmemail/SomeReallyLargeToken/SomeGuidUserId
我认为应该可以。
更新:如果您想从查询参数中精确获取值,请参见以下示例: https://learn-blazor.com/pages/router/
UPDATE: If you want to get values exactly from query parameters good example is here https://learn-blazor.com/pages/router/
这篇关于Blazor路由中的多个查询字符串参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!