我尝试了如下所示的许多选择,并从许多SO问题中得到了答案
filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { action = "Index", controller = "Home" }));
base.OnActionExecuting(filterContext);
filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { action = "Index", controller = "Home" }));
filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext);
filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { action = "Index", controller = "Home" }));
return;
filterContext.Result = new RedirectResult("~/");
但是这些选项都没有重定向,它调用了主控制器的索引方法,但是重定向不起作用。
请告知。
谢谢