Blazor路由中的多个查询字符串参数

编程入门 行业动态 更新时间:2024-10-27 04:30:37
本文介绍了Blazor路由中的多个查询字符串参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我当前的项目中有多个工作示例,这些示例从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

如何实现?

推荐答案

您可以尝试吗?

localhost:50466/confirmemail/SomeReallyLargeToken/SomeGuidUserId

我认为应该可以。

更新:如果您想从查询参数中精确获取值,请参见以下示例: learn-blazor/pages/router/

UPDATE: If you want to get values exactly from query parameters good example is here learn-blazor/pages/router/

更多推荐

Blazor路由中的多个查询字符串参数

本文发布于:2023-11-13 01:16:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583006.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   路由   字符串   参数   Blazor

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!