Asp.net core mvc 并非所有查询参数都显示在返回url中

Asp.net core mvc 并非所有查询参数都显示在返回url中,asp.net-core-mvc,cookie-authentication,Asp.net Core Mvc,Cookie Authentication,我已经构建了一个ASP.NET核心MVC应用程序,并使用cookie身份验证。下面是我在Startup.cs文件中的代码 services.AddAuthentication(选项=> { //这些必须设置为其他ASP.NET内核将引发异常 //设置了默认身份验证方案或默认质询方案。 options.DefaultAuthenticateScheme=CookieAuthenticationDefaults.AuthenticationScheme; options.defaultsignnsc

我已经构建了一个ASP.NET核心MVC应用程序,并使用cookie身份验证。下面是我在Startup.cs文件中的代码

services.AddAuthentication(选项=>
{
//这些必须设置为其他ASP.NET内核将引发异常
//设置了默认身份验证方案或默认质询方案。
options.DefaultAuthenticateScheme=CookieAuthenticationDefaults.AuthenticationScheme;
options.defaultsignnscheme=CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme=CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie(选项=>
{
options.LoginPath=“/Account/Login/”;
});
当cookie过期时,应用程序将重定向到
/Account/Login
路径,返回包含用户所在的当前Url的Url。在当前url具有
0
1
查询参数之前,此功能正常工作。如果当前url有2个查询参数,则仅将第一个查询参数传递给返回url。登录方法如下所示

public IActionResult登录(字符串返回URL)
{
返回视图(新的LogInViewModel{ReturnUrl=ReturnUrl});
}
e、 g。 如果当前URL为
/Inspection?inspectionID=1&processTypeID=2
,则返回的URL仅获取
/Inspection?inspectionID=1
processtypeID
参数不存在

但是,当浏览器在cookie过期时导航到
/Account/Login
URL时,它会显示正确的URL
/Account/Login?ReturnUrl=/Inspection?inspectionID=1&processTypeID=2

有人能告诉我为什么会发生这种情况以及如何解决吗

谢谢,
Zehan对重定向uri的值进行编码为我解决了这个问题

就我而言,我有一个blazor页面,其中包含:

其中
RedirectUri
返回完整的当前页面路径,包括多个查询参数

我将链接更改为:

,密钥是
UrlEncode(RedirectUri)
,它为我解决了这个问题

UrlEncode
可以在命名空间
System.Web.HttpUtility

上找到。如果“ReturnUrl”是一个查询字符串,那么什么类型的“processTypeID”?