Asp.net mvc MVC 5用于外部登录的返回URL
是否有人知道如何/在何处设置传递给ASP.Net MVC 5应用程序上的AccountController的returnUrl参数:Asp.net mvc MVC 5用于外部登录的返回URL,asp.net-mvc,authentication,asp.net-mvc-5,owin,Asp.net Mvc,Authentication,Asp.net Mvc 5,Owin,是否有人知道如何/在何处设置传递给ASP.Net MVC 5应用程序上的AccountController的returnUrl参数: // POST: /Account/ExternalLogin [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public ActionResult ExternalLogin(string provider, string returnUrl) {
// POST: /Account/ExternalLogin
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult ExternalLogin(string provider, string returnUrl)
{
// Request a redirect to the external login provider
return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }));
}
这通常在查询字符串中进行,假设您的“管理”页面需要经过授权的登录用户,因此当用户单击管理页面时,它会重定向到登录页面,并将返回url设置为“管理”页面 具体来说,它是CookieHandler/Cookie OWIN中间件,该中间件正在重定向到登录页面,并自动将当前Uri附加到returnUrl的查询字符串中