简体   繁体   中英

ASP.NET 5 - The ReturnUrl concept

What is the ReturnUrl? In the ASP.NET 5 Web Appliation it returns you to Account/Login. I set Login as a Partial View on the Index Page, so I don't use the Login Page, but if I use an Action, which has the [Authorize] property and I'm not logged in, it returns me to Account/Login. What do I have to do to return me to the Index Page?

Thanks!

PS: the first comment is a solution for ASP.NET 4 MVC 5, not ASP.NET 5

If you want to redirect users, who are not logged in on custom page, you should configure in your Startup.cs in ConfigureServices() method:

        services.AddIdentity<User<string>, Role<string>>(
            options => {
                options.Cookies.ApplicationCookie.LoginPath = "Home/Index";
            }).AddDefaultTokenProviders();

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