public override void OnActionExecuting (ActionExecutingContext filtercontext) {//This One step is to verify whether to log in if (filtercontext.httpcontext.session["User"] = = NULL) {//When using this method, the page
The output will also run to the following code, using return is not effective;
FilterContext.HttpContext.Response.Redirect ("~/home/index", true);
return;
Errorredirect (Filtercontext); }
Error handling method
private void Errorredirect (ActionExecutingContext filtercontext)
{
//Note: by In the front page of the IFRAME frame, use the following method to jump to the iframe inside, so can not be annotated with the method
//Filtercontext.result = new Redirecttorouteresult ("D Efault ", new RouteValueDictionary (New {controller =" Home ", action =" Index "}));
Filtercontext.result = new Redirectresult ("/home/index");
Contentresult content = new Contentresult ();
Content. Content = "<script language= ' javascript ' > top.location.href = '/home/index ';</script>";
Filtercontext.result = content;
}//End Errorredirect