简体   繁体   中英

C# MVC Web App using Azure AD randomly started redirecting about 10 times before failing

I wrote a web app for internal use in my company and it has not had a problem in the few months it's been live. On Friday, folks said they could no longer login any longer. Nothing in the code changed apart from some javascript. Nothing in Azure seemingly changed.

Here's what happens: I go through the normal procedure of entering my credentials, then I get redirected to the company's 2FA stuff. Once I pass that, it asks me if I want to stay logged in. From there, I can watch the URL in my address bar change about 10 times before finally just giving the famous "We couldn't sign you in. Please try again."

I am making sure to access the web app using HTTPS, btw. Anonymous login is set in Azure. I don't know what to do. Any help is appreciated greatly!

My boss figured it out late yesterday evening.

added a rewrite rule to system.webServer

 <rewrite> <outboundRules> <rule name="Add SameSite" preCondition="No SameSite"> <match serverVariable="RESPONSE_Set_Cookie" pattern=".*" negate="false" /> <action type="Rewrite" value="{R:0}; SameSite=none;" /> <conditions> </conditions> </rule> <preConditions> <preCondition name="No SameSite"> <add input="{RESPONSE_Set_Cookie}" pattern="." /> <add input="{RESPONSE_Set_Cookie}" pattern="; SameSite=none" negate="true" /> </preCondition> </preConditions> </outboundRules> </rewrite>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM