是他是他就是它:
就是一句话解决:
filterContext.Result = new RedirectResult("/User/MyLogin");
过滤器代码
public class LoginAuthAttribute: ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext){
var uId = filterContext.HttpContext.Session.GetString("uId");if (uId == null){
//仅有这句话跳转时登陆界面会显示在iframe框架中//filterContext.HttpContext.Response.Redirect("/User/MyLogin");filterContext.Result = new RedirectResult("/User/MyLogin");//filterContext.HttpContext.Response.StatusCode = 404 ;//filterContext.HttpContext.Response.();//base.OnActionExecuting(filterContext);}}}