Hi Bhassan,
Thanks for Confirming. The HTTP ERROR 414 you're seeing on the login page is likely caused by an overly long request URL or headers and in our case, since we're using custom ASP.NET Core authentication (not Azure AD), this is most likely due to one of the following:
- ASP.NET Core uses cookie-based authentication, which stores user claims in the cookie itself. If we’re storing too many or large claims (like serialized user data, permissions, or tokens), the cookie can grow beyond the limit accepted by the server — especially on Linux-based Azure App Service which uses Nginx.
solution:-- We should review and limit the number and size of claims added during sign-in. Only essential claims (like user ID or username) should be included.
- Cookie-Based TempData or ViewData- By default, ASP.NET Core stores
TempData
in cookies. If we’re storing large messages, error details, or return URLs inTempData
, it will inflate the cookie size.
solution:-- We can switch TempData
to use session-based storage by updating our Startup.cs
:
services.AddSession();
services.AddControllersWithViews()
.AddSessionStateTempDataProvider();
And in the middleware pipeline:
app.UseSession();
This keeps large data off the client and avoids oversized request headers.
- Another potential cause is if our login redirects (like
ReturnUrl=...
) include very long or encoded data — for example, if we’re appending serialized JSON or long query strings to the login URL.
solution:-- We should avoid placing large data in the query string. Instead, store it in session or cache, and just pass a short key or ID in the URL.
collective Keypoints-
- Reviewing the size of cookies during login (check browser DevTools → Network).
- Refactoring the
ClaimsPrincipal
to remove any unnecessary claims. - Switching
TempData
to session-backed storage. - Validating that redirect URLs are short and safe.
Please refer ,
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/app-state?view=aspnetcore-9.0
https://learn.microsoft.com/en-us/entra/identity-platform/reply-url
If you have any further assistant, do let me know.
If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.