You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: support/entra/entra-id/app-integration/asp-dot-net-application-infinite-sign-in-loop.md
+13-15Lines changed: 13 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: Infinite sign-in loop between ASP.NET application and Microsoft Entra ID
2
+
title: Infinite Sign-in Loop Between ASP.NET Application and Microsoft Entra ID
3
3
description: Helps you resolve an infinite sign-in loop issue between an ASP.NET application and with Microsoft Entra ID when performing sign in.
4
-
ms.date: 04/23/2025
4
+
ms.date: 04/25/2025
5
5
ms.author: bachoang
6
6
ms.service: entra-id
7
7
ms.custom: sap:Developing or Registering apps with Microsoft identity platform
@@ -13,27 +13,27 @@ This article provides solutions to an issue where an ASP.NET application experie
13
13
14
14
## Symptoms
15
15
16
-
An ASP.NET application running an old version of OWIN middleware fails to recognize an authenticated request from Microsoft Entra ID. It keeps sending the request back to Microsoft Entra ID for signing in, leading to the infinite loop issue. The following error message might be displayed in the browser:
16
+
An ASP.NET application running an earlier version of Open Web Interface for .NET (OWIN) middleware fails to recognize an authenticated request from Microsoft Entra ID. It keeps sending the request back to Microsoft Entra ID for signing in, leading to the infinite loop issue. The following error message might be displayed in the browser:
17
17
18
18
> We couldn't sign you in. Please try again.
19
19
20
20
## Cause
21
21
22
-
This issue occurs due to a cookie mismanagement issue (a [known Katana bug](https://github.com/aspnet/AspNetKatana/wiki/System.Web-response-cookie-integration-issues)) in the old version of OWIN.
22
+
This issue occurs due to a cookie mismanagement issue (a [known Katana bug](https://github.com/aspnet/AspNetKatana/wiki/System.Web-response-cookie-integration-issues)) in the earlier version of OWIN.
23
23
24
24
### How to recognize the Katana bug
25
25
26
-
Capture a Fiddler trace and examine one of the later redirect frames back to the web application. Note in the following screenshot, the request in frame 58 contains multiple OpenIdConnect.nonce cookies (red-circled). In a working scenario, you should only have one OpenIdConnect.nonce cookie set at the beginning before authentication. After the request is successfully authenticated, this nonce cookie is destroyed and ASP.NET sets its own session cookie. Because of this bug, you see there is a build up of these nonce cookies.
26
+
Capture a Fiddler trace and examine one of the later redirect frames back to the web application. Note in the following screenshot, the request in frame 58 contains multiple OpenIdConnect.nonce cookies (red-circled). In a working scenario, you should only have one OpenIdConnect.nonce cookie set at the beginning before authentication. After the request is successfully authenticated, this nonce cookie is destroyed and ASP.NET sets its own session cookie. Because of this bug, you see a buildup of these nonce cookies.
The issue has been resolved in ASP.NET Core and a newer version of Katana OWIN for ASP.NET. To resolve this issue, upgrade your application to use ASP.NET Core.
32
+
The issue is resolved in ASP.NET Core and a later version of Katana OWIN for ASP.NET. To resolve this issue, upgrade your application to use ASP.NET Core.
33
33
34
-
If you must continue to use ASP.NET, perform the following things:
34
+
If you must continue to use ASP.NET, perform the following actions:
35
35
36
-
- Update your application's Microsoft.Owin.Host.SystemWeb package to be at least version 3.1.0.0.
36
+
- Update your application's Microsoft.Owin.Host.SystemWeb package to version 3.1.0.0 or later.
37
37
- Modify your code to use one of the new cookie manager classes, for example:
38
38
39
39
```csharp
@@ -44,8 +44,6 @@ If you must continue to use ASP.NET, perform the following things:
@@ -55,13 +53,13 @@ If you must continue to use ASP.NET, perform the following things:
55
53
56
54
## Solution 2: Correct the redirect URL
57
55
58
-
Insomecaseswheretheapplicationishostedunderavirtualdirectoryoranapplicationinsteadoftherootofthewebsite, the[solution1](#solution-1-upgrade-to-aspnet-core) mightnotwork. Formoreinformation, see [Infinitere-directloopafterAADAuthenticationwhenredirectisspecified](https://stackoverflow.com/questions/44397715/infinite-re-direct-loop-after-aad-authentication-when-redirect-is-specified) and [Microsoft Account OAuth2 sign-on fails when redirect URL is not under the website root](https://github.com/aspnet/AspNetKatana/issues/203).
56
+
Insomecaseswheretheapplicationishostedunderavirtualdirectoryoranapplicationinsteadoftherootofthewebsite, [solution 1](#solution-1-upgrade-to-aspnet-core) mightnotwork. Formoreinformation, see [Infinitere-directloopafterAADAuthenticationwhenredirectisspecified](https://stackoverflow.com/questions/44397715/infinite-re-direct-loop-after-aad-authentication-when-redirect-is-specified) and [Microsoft Account OAuth2 sign-on fails when redirect URL is not under the website root](https://github.com/aspnet/AspNetKatana/issues/203).
0 commit comments