How does redirect to returnUrl work in Asp.Net MVC5

前端 未结 4 697
生来不讨喜
生来不讨喜 2020-12-31 11:55

I\'ve started a new MVC 5 site, using the new Asp.Net Identity with Owin. In my \"account\" controller which has the attribute [Authorize], I have fairly standard actions;

4条回答
  •  悲&欢浪女
    2020-12-31 12:13

           if (Url.IsLocalUrl(returnUrl))
            {
                return Redirect(returnUrl);
            }
            else
            {
                return RedirectToAction("Index", "Controller");
            }
    

提交回复
热议问题