Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.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
C# 如何使用托管在.Net framework 4.6应用程序中的登录页对.Net Core 3.1上的IdentityServer 4应用程序进行身份验证?_C#_Asp.net_Cookies_Identityserver4_Asp.net Core 3.1 - Fatal编程技术网

C# 如何使用托管在.Net framework 4.6应用程序中的登录页对.Net Core 3.1上的IdentityServer 4应用程序进行身份验证?

C# 如何使用托管在.Net framework 4.6应用程序中的登录页对.Net Core 3.1上的IdentityServer 4应用程序进行身份验证?,c#,asp.net,cookies,identityserver4,asp.net-core-3.1,C#,Asp.net,Cookies,Identityserver4,Asp.net Core 3.1,我们在.NETFramework4.6应用程序上有一个当前登录页面。 我们正在构建一个新的.Net Core 3.1 IdentityServer 4应用程序,主要用于颁发令牌,但在代码身份验证过程中,我们希望重定向到当前.Net framework 4.6应用程序中托管的登录页面 从IDServer应用重定向到.Net framework 4.6应用的登录页面工作正常,但在.Net framework 4.6应用创建并设置cookie后,IdentityServer 4似乎没有响应此cooki

我们在.NETFramework4.6应用程序上有一个当前登录页面。 我们正在构建一个新的.Net Core 3.1 IdentityServer 4应用程序,主要用于颁发令牌,但在代码身份验证过程中,我们希望重定向到当前.Net framework 4.6应用程序中托管的登录页面

从IDServer应用重定向到.Net framework 4.6应用的登录页面工作正常,但在.Net framework 4.6应用创建并设置cookie后,IdentityServer 4似乎没有响应此cookie

有人知道如何在.Net framework 4.6应用程序中实现登录,然后重定向回IdentityServer并在登录后处理令牌吗

在IdentityServer中,以下代码可以重定向到.Net framework 4.6应用程序:

services.AddIdentityServer(选项=>
{
options.UserInteraction.LoginUrl=”https://localhost:44352/login/";
options.UserInteraction.LoginReturnUrlParameter=“returnUrl”;
})
但在应用程序运行之后“https://localhost:44352/login/设置标识cookie并使用提供的返回URL重定向回identity Server 4,identity Server 4未读取该cookie。
我们甚至尝试使用另一个使用Microsoft的Identity package的.Net Core 3.1应用程序创建Identity cookie,该程序在Identity Server 4中运行,但在另一个应用程序中创建此cookie并将其传递给Identity Server 4时不起作用。

我没有尝试过,但您可以执行以下操作(一般情况下)

  • 两个平台上的Cookie域名和名称应相同(web应用程序)
  • 两个应用程序上的机器密钥必须相同

  • 我没有试过,但你可以做以下事情(一般情况下)

  • 两个平台上的Cookie域名和名称应相同(web应用程序)
  • 两个应用程序上的机器密钥必须相同
  • 您的应用程序(ASP.NET核心和经典ASP)和IdentityServer不共享相同的Cookie

    IdentityServer发布自己的Cookie,并且无法在ASP.NET和ASP.NET核心之间读取会话Cookie(它们受到不同的保护)

    一般来说,我认为要获得单一登录体验,两个应用程序(ASP.NET和ASP.NET核心)都需要独立地进行身份验证,以识别服务器并获得自己的令牌集。但是用户只需登录一次IdentityServer,因为在第一次登录后,IdentityServer将使用其cookie记住您是谁。

    您的应用程序(ASP.NET核心和经典ASP)和IdentityServer不共享相同的cookie

    IdentityServer发布自己的Cookie,并且无法在ASP.NET和ASP.NET核心之间读取会话Cookie(它们受到不同的保护)

    一般来说,我认为要获得单一登录体验,两个应用程序(ASP.NET和ASP.NET核心)都需要独立地进行身份验证,以识别服务器并获得自己的令牌集。但是用户只需要登录一次IdentityServer,因为在第一次登录之后,IdentityServer将使用其cookie记住您是谁