<script type="text/javascript">
$(document).ajaxComplete(function (event, xhr, options) {          
if (xhr.status == 999) {
window.parent.location.href = "/Home/Login";
}
});
</script>


C#后台代码设置,在过滤器里面
context.HttpContext.Response.StatusCode = 999;
context.HttpContext.Response.StatusDescription = "NoLogin";

本文转载:CSDN博客