1.可以在登录页面加jQuery验证
$(function () { //判断一下当前是不是做顶层,如果不是,则做一下顶层页面重定向 if (window != top) { top.location.href = location.href; } });
2.OnActionExecuting方法中修改filterContext.Result
filterContext.Result = new ContentResult() { Content = "<script>top.window.location.href='/user/Login'</script>" };