简体   繁体   English

Azure Active Directory B2C不反序列化MVC项目中的httpContext.Session

[英]Azure Active Directory B2C not deserializing httpContext.Session in MVC project

I successfully got the github sample "active-directory-b2c-dotnet-webapp-and-webapi" working with my own Tenant and the Azure Active Directory B2C. 我成功地使用自己的租户和Azure Active Directory B2C获得了github示例“ active-directory-b2c-dotnet-webapp-and-webapi”。 It is working as expected. 它按预期工作。 When I create my own MVC project from scratch and replicate every single thing down to the exact same dll's, it fails to reproduce the same results as the sample. 当我从头开始创建自己的MVC项目并将每件事复制到完全相同的dll时,它无法再现与示例相同的结果。 It fails when trying to Deserialize the HttpContext.Session within the MSALSessoCache Class, Load method. 尝试在MSALSessoCache类的Load方法中反序列化HttpContext.Session时,它将失败。

I can see that I am getting the token back with the proper information and claims when in the OnAuthorizationCodeReceived. 我可以看到,在OnAuthorizationCodeReceived中,我已经获得了带有正确信息和声明的令牌。 It also reflects in the portals audit logs as success. 它还在门户审核日志中反映为成功。 When stepping through the code, the deserialization results in a null object exception when casting to blob. 单步执行代码时,反序列化在转换为blob时会导致空对象异常。 I can see the user info and the fact that it works in the sample, I am assuming the Azure Tenant is correct. 我可以在示例中看到用户信息以及它可以正常运行的事实,我假设Azure租户是正确的。

I created the new .net 4.7.2 MVC application with "No Authentication" , changed to HTTPS as well as updated the Project Url in properties. 我使用“无身份验证”创建了新的.net 4.7.2 MVC应用程序,将其更改为HTTPS并更新了属性中的项目URL。 I copied the code over verifying the OWIN Startup.cs class and Startup.Auth.cs. 我通过验证OWIN Startup.cs类和Startup.Auth.cs复制了代码。 Everything is identical with exception to the https redirect url and https TaskServiceUrl within the web.config... even the exact same versions of the dll's. 一切都相同,只是web.config中的https重定向url和https TaskServiceUrl例外,甚至与dll的版本完全相同。 I have also verified that the proper https url have been added in the tenants application setup with Azure B2C. 我还验证了使用Azure B2C在租户应用程序安装程序中添加了正确的https URL。 I am at a loss. 我很茫然。

With some assistance, we figured out that downgrading the Microsoft.Identity.Client dll to 1.1.0.0 prerelease did the trick. 在一些帮助下,我们发现将Microsoft.Identity.Client dll降级到1.1.0.0预发行版本可以解决问题。 I know that 1.1.4.0 and 2.0.0 does not work. 我知道1.1.4.0和2.0.0 无法正常工作。 Can't say whether 1.1.1.0, 1.1.2.0 or 1.1.3.0 works or not. 无法说1.1.1.0、1.1.2.0或1.1.3.0是否有效。 Thanks asmithKinegdo 感谢asmithKinegdo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure Active Directory B2C 注册 - Azure Active Directory B2C registration Kendo UI DatePicker Javascript和HttpContext.Session C#,MVC - Kendo UI DatePicker Javascript and HttpContext.Session C#, MVC 如果读取,httpcontext.session会保持活动状态吗? - will httpcontext.session stay active if read? 如何在 ASP.NET MVC 中获取/设置自定义 Azure Active Directory B2C 用户属性? - How to get/set custom Azure Active Directory B2C user attributes in ASP.NET MVC? `[Authorize(Roles =“admin”)]`无限循环ASP.NET MVC和Azure Active Directory B2C - `[Authorize(Roles = “admin”)]` Infinite loop ASP.NET MVC and Azure Active Directory B2C 无法使用GraphServiceClient更新Azure Active Directory B2C用户 - ASP.NET MVC - Can't update Azure Active Directory B2C user using GraphServiceClient - ASP.NET MVC C# Web 应用程序中的 Azure Active Directory B2C - Azure Active Directory B2C in a C# webapplication Azure B2C Active Directory OpenIDConnect和授权代码 - Azure B2C Active Directory OpenIDConnect and Authorization Codes 在 Azure Active Directory B2C 中按组授权 - Authorize By Group in Azure Active Directory B2C Azure Active Directory B2C-权限不足,无法完成操作 - Azure Active Directory B2C - Insufficient privileges to complete the operation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM