aspnet / AspNetKatana

Microsoft's OWIN implementation, the Katana project
Apache License 2.0
960 stars 331 forks source link

Keeps redirecting to login page #482

Closed tech-thanoshotels closed 8 months ago

tech-thanoshotels commented 1 year ago

I am using asp.net 4.8 and in the production environment sometime the login does not work. As soon as I recycle the app pool then users can login.

I have updated via nuget to version 4.2.2 and other projects running version 4.2.0 does not seem to have the problem. Any ideas ?

Tratcher commented 1 year ago

Can you share a Fiddler trace?

Check: https://github.com/aspnet/AspNetKatana/wiki/System.Web-response-cookie-integration-issues

tech-thanoshotels commented 1 year ago

We have tried several things, from generating a unique machine key to changing versions of the below to the latest and to previous versions but no option worked. Please also find attached a fiddler trace. If you see in the trace the user trying to login to the https://hr.thanoshotels-apps.com/Login page and entered correctly his credentials. The system authenticated him (see below my code for doing that) and I also have a record saved to verify that the authentication was successful but for some reason he was treated as not authenticated and returned to login page.

@.***

@.***

Code to authenticate user (used the same as the standard asp.net project creation using identity) see below

@.***

Also in the login page I have this code which if the user is indeed authenticated it rectirects them to correct page.

@.***

Kindly let us know your thoughts on this.

Best regards,

Ioannis Ioannou Software Engineering Manager

From: Chris Ross @.> Sent: 31 October, 2022 5:27 PM To: aspnet/AspNetKatana @.> Cc: Ioannis Ioannou - Software Engineering Manager Thanos Hotels @.>; Author @.> Subject: Re: [aspnet/AspNetKatana] Keeps redirecting to login page (Issue #482)

Can you share a Fiddler trace?

Check: https://github.com/aspnet/AspNetKatana/wiki/System.Web-response-cookie-integration-issues

— Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetKatana/issues/482#issuecomment-1297260859, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYVAQM2X33QXS3KVPWEGWTLWF7QMZANCNFSM6AAAAAARS55HNQ. You are receiving this because you authored the thread.Message ID: @.**@.>>

Tratcher commented 1 year ago

Most of that didn't come through, including the attachment. You'll have to post them directly on github, or send it to the address in my profile.

tech-thanoshotels commented 1 year ago

Hi Chris,

Please see the fiddler export here [​Folder icon] asp.net identity loghttps://thanoshotels.sharepoint.com/:f:/s/tech/Eoz835RuRpNHvRPUkTWP_VABUhgB8Y187Ug5nuSlv6aL2w?e=OgobVr

I am also including my previous email below

We have tried several things, from generating a unique machine key to changing versions of the below to the latest and to previous versions but no option worked. Please also find attached a fiddler trace. If you see in the trace the user trying to login to the https://hr.thanoshotels-apps.com/Login page and entered correctly his credentials. The system authenticated him (see below my code for doing that) and I also have a record saved to verify that the authentication was successful but for some reason he was treated as not authenticated and returned to login page.

@.***

@.***

Code to authenticate user (used the same as the standard asp.net project creation using identity) see below

@.***

Also in the login page I have this code which if the user is indeed authenticated it rectirects them to correct page.

@.***

Best regards,

Ioannis Ioannou Software Engineering Manager

From: Chris Ross @.> Sent: 1 November, 2022 10:32 PM To: aspnet/AspNetKatana @.> Cc: Ioannis Ioannou - Software Engineering Manager Thanos Hotels @.>; Author @.> Subject: Re: [aspnet/AspNetKatana] Keeps redirecting to login page (Issue #482)

Most of that didn't come through, including the attachment. You'll have to post them directly on github, or send it to the address in my profile.

— Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetKatana/issues/482#issuecomment-1299102850, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYVAQMZZJ7B53H3Y3HSLQIDWGF43VANCNFSM6AAAAAARS55HNQ. You are receiving this because you authored the thread.Message ID: @.**@.>>

Tratcher commented 1 year ago

Your login response is not including any cookies, but it does include the cache headers that would normally be set with the cookies. Try the following workaround: https://github.com/aspnet/AspNetKatana/wiki/System.Web-response-cookie-integration-issues

tech-thanoshotels commented 1 year ago

This refers though to asp.net core, we are using asp.net 4.8 web forms project or it does not matter ? Also any ideas why it does happen randomly ? and why once I recycle the app pool then the logins works without issue

From: Chris Ross @.> Sent: 1 November, 2022 10:43 PM To: aspnet/AspNetKatana @.> Cc: Ioannis Ioannou - Software Engineering Manager Thanos Hotels @.>; Author @.> Subject: Re: [aspnet/AspNetKatana] Keeps redirecting to login page (Issue #482)

Your login response is not including any cookies, but it does include the cache headers that would normally be set with the cookies. Try the following workaround: https://github.com/aspnet/AspNetKatana/wiki/System.Web-response-cookie-integration-issues

— Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetKatana/issues/482#issuecomment-1299113667, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYVAQMYSPZXC3L7TV4HXDVTWGF6FBANCNFSM6AAAAAARS55HNQ. You are receiving this because you authored the thread.Message ID: @.**@.>>

Tratcher commented 1 year ago

That writeup is about Katana and ASP.NET 4.8, not AspNetCore.

The issue can appear randomly because of conflicts with other cookies in the application.