Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 如何使用哈希参数重定向到url的ASP.net MVC操作_Asp.net Mvc_Asp.net Core_Identityserver4 - Fatal编程技术网

Asp.net mvc 如何使用哈希参数重定向到url的ASP.net MVC操作

Asp.net mvc 如何使用哈希参数重定向到url的ASP.net MVC操作,asp.net-mvc,asp.net-core,identityserver4,Asp.net Mvc,Asp.net Core,Identityserver4,我正在使用ASP.NETCore2.2。我重定向到identity server实例,然后该实例重定向回我的MVC应用程序。重定向回url的格式为: http://localhost:8081/home/fetchtokenresponse#id_token=longtokenvalue&token_type=Bearer&expires_in=3600&scope=myscopes&session_state=jizlw_6DiGhYvkGk6fKRKkhZQoFlYKJ5v1_2Lwd-ca

我正在使用ASP.NETCore2.2。我重定向到identity server实例,然后该实例重定向回我的MVC应用程序。重定向回url的格式为:

http://localhost:8081/home/fetchtokenresponse#id_token=longtokenvalue&token_type=Bearer&expires_in=3600&scope=myscopes&session_state=jizlw_6DiGhYvkGk6fKRKkhZQoFlYKJ5v1_2Lwd-caI.MN0g0HwpGuulkwKleHtJCg

在我的操作中,我希望能够读取如下参数

public IActionResult FetchTokenResponse(string id_token)
我尝试过的

我尝试添加带有has标记的新路线,但这似乎是非法的:

routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}#{id?}");

是否有其他方法可以截取路径并重定向到我的操作?

您需要修改身份验证请求以使用IdentityServer以使用
response\u mode=form\u post
response\u mode=query

未将片段发送到服务器,如中所定义:。
当您希望前端JavaScript获取令牌时,将使用片段响应模式。

为什么要这样做?id_令牌很可能只包含
声明(默认情况下),如果不包含(因为您可能已经设置了
选项。GetClaimsFromUserInfoEndpoint=true
),这些声明将自动添加到cookie中。access_令牌也在其中,我可能没有很好地展示这一点。我拥有的是一个使用LDAP身份验证的应用程序,但由于各种原因,它需要调用到不同的集群中,并且需要对它们进行身份验证。