简而言之:如何在另一个控制器中执行操作后重定向到我刚刚访问的页面? 解决方案 尝试:public ActionResult MyNextAction(){返回重定向(Request.UrlReferrer.ToString());}或者,触及达林所说的,试试这个:public ActionResult MyFirstAction(){return RedirectToAction("MyNextAction",新 { r = Request.Url.ToString() });}然后:public ActionResult MyNextAction(){返回重定向(Request.QueryString["r"]);}Lets suppose that I have some pagessome.web/articles/details/5some.web/users/info/bobsome.web/foo/bar/7that can call a common utility controller likelocale/change/es or authorization/loginHow do I get these methods (change, login) to redirect to the previous actions (details, info, bar) while passing the previous parameters to them (5, bob, 7)?In short: How do I redirect to the page that I just visited after performing an action in another controller? 解决方案 try:public ActionResult MyNextAction(){ return Redirect(Request.UrlReferrer.ToString());}alternatively, touching on what darin said, try this:public ActionResult MyFirstAction(){ return RedirectToAction("MyNextAction", new { r = Request.Url.ToString() });}then:public ActionResult MyNextAction(){ return Redirect(Request.QueryString["r"]);} 这篇关于如何重定向到 ASP.NET MVC 中的上一个操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-28 06:05