Asp.net core Identity successful login redirecting back to login page

asp.net redirect to login page with return url
asp.net core redirect to login
redirect to requested page after login in asp.net c#
asp.net core redirect after login
asp.net keeps redirecting to login page
asp net core login page
asp net core authentication
mvc 5 redirect to login page if not authenticated

I have a problem where the asp.net identity framework is redirecting the user back to the login page after they have logged in successfully.

This is using the standard Asp.net Core Identity. It is the version 2.1.1. The scaffolding that generates the razor pages. Not sure if that is significant.

I know the user is successfully logging in because I get the log message

...Areas.Identity.Pages.Account.LoginModel: Information: User logged in.

But then it redirects straight back to the login page.

If I use fiddler I can see that there is a cookie on the request so it all looks good from that perspective.

.AspNetCore.Identity.Application=CfDJ8KJxkuir9ZJIjFLCU2bzm9n6X...

So I guess the middleware that is handling the authentication but not accepting the cookie?

If I could see what the actual middleware for the auth was doing I might have an idea but I can't find it.

Any help appreciated

Asp.net core Identity successful login redirecting back to login page , In order to get the ASP.NET Core pipeline to recognise that a user is signed in, a call to UseAuthentication is required in the Configure method of your Startup class, like so: app. UseAuthentication(); app. UseMvc(); // Order here is important (explained below). Asp.net core Identity successful login redirecting back to login page. I have a problem where the asp.net identity framework is redirecting the user back to the login page after they have logged in successfully. This is using the standard Asp.net Core Identity. It is the version 2.1.1. The scaffolding that generates the razor pages.

app.UseAuthentication(); app.UseMvc();

This was already in my code.However I was facing same issue. But the problem was with the Chrome browser on my case.It was working with other browser like mozilla. It starts to work on Chrome too, after i cleared all the cookies and cashes.

Login keeps redirecting back to Login Page, How to redirect the user to the original requested URL after a successful login. NET Core Duration: 4:32 Posted: Jun 17, 2019 IdentityServer4 ASP.NET Core Identity does not redirect back to client. I have basic IdentityServer4 with Asp.Net Core Identity. After redirecting to the login page and signing in, IdentityServer does not redirect me back to the client.

In addition to @Kirk Larkin answer if you use .net core 3 (in this time is preview version)

put your "app.UseEndpoints" in startup.cs to end of the code block.

for example it should be in this order

        app.UseAuthentication();
        app.UseAuthorization();

        app.UseEndpoints(endpoints =>
        {
            endpoints.MapControllerRoute(
                name: "default",
                pattern: "{controller=Home}/{action=Index}/{id?}");
            endpoints.MapRazorPages();
        });

Redirect user to original url after login in asp net core, Login Sign Up Identity.IsAuthenticated) { <p class="navbar-text">Hello, @User. AspNetCore; public class AccountController : Controller { public After successful authentication, the browser is redirected back to your  I got around this for the time being by having my identity/account/login page redirect to /account/login but if you have any other ideas on how to properly fix that, I'd rather not leave that redirect in the project – Kyle Jun 1 '18 at 16:16

Note that the order is IMPORTANT. I had these reversed and experienced the exact same problem the original poster experienced. Hours wasted before I figured this out...

    app.UseAuthentication();
    app.UseAuthorization();

Redirect to the sign-in page, I will show how to setup, login and logout using local logins, a custom ASP.​NET Core 2.0 provides various ways of implementing cookie-based <span><i class="glyphicon glyphicon-ok text-success"></i>  Hello @User.Identity.​Name</span> Clicking on submit redirects me back the home page, whereas I see a  In this scenario, when the user directly clicks on MyFriends, the system will redirect you to the login page, because the system requires a logged in user. After successful login, the system should open MyFriends page automatically. Logical Answer To achieve this, Check if the user is logged in or not in FriendList.aspx page.

ASP.NET Core 2.0 Cookie Authentication – Local logins – Code , ASP.NET Core Identity adds user interface (UI) login functionality to ASP. Depending on your screen size, you might need to select the If the user was created successfully, the user is logged in by the call to In the preceding code, the code return RedirectToPage(); needs to be a redirect so that the  External Login Providers in ASP.NET Core May 3, 2017 by Rui Figueiredo 8 Comments Being able to have your users authenticate using Google, Facebook, Twitter, etc is a great way to remove the annoyance of having to create a local account and go through the email validation process.

Introduction to Identity on ASP.NET Core, The Identity system redirected me to the Login URL Microsoft.AspNetCore.​Identity.SignInResult result = await signInManager. Its 'Succeeded' property contains true value if the sign in is successful else returns false. Run your project, and when you are redirected to the Login page, add the following  Microsoft Account external login setup with ASP.NET Core. 03/19/2020; 4 minutes to read +9; In this article. By Valeriy Novytskyy and Rick Anderson. This sample shows you how to enable users to sign in with their work, school, or personal Microsoft account using the ASP.NET Core 3.0 project created on the previous page.

How to do Authentication of Users in Identity in ASP.NET Core, So our main goal is going to be creating a login page and preparing a set of NET Core Identity tries to redirect an unauthorized user to the First, we check if the model is invalid and if it is, we just return a view with the model. Now if we login successfully in our application, we can see the cookie  Here Mudassar Ahmed Khan has explained with an example, a simple login form using Forms Authentication which validates user login from database and also redirects user to Login page if the user is not logged in and tries to access a page that requires authentication in ASP.Net using C# and VB.Net. TAGs: ASP.Net