[英]ASP.NET 5 - The ReturnUrl concept
What is the ReturnUrl? 什么是ReturnUrl? In the ASP.NET 5 Web Appliation it returns you to Account/Login.
在ASP.NET 5 Web应用程序中,它将使您返回到帐户/登录。 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.
我将“登录”设置为索引页面上的部分视图,所以我不使用“登录”页面,但是如果我使用具有[Authorize]属性且未登录的操作,它将返回到“帐户/登录。 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 PS:第一个评论是针对ASP.NET 4 MVC 5的解决方案,而不是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: 如果要重定向未在自定义页面上登录的用户,则应在Startup.cs中的ConfigureServices()方法中进行配置:
services.AddIdentity<User<string>, Role<string>>(
options => {
options.Cookies.ApplicationCookie.LoginPath = "Home/Index";
}).AddDefaultTokenProviders();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.