public override void OnException(ExceptionContext filterContext)
    {
        if (filterContext.ExceptionHandled) return;
        if (new HttpException(null, filterContext.Exception).GetHttpCode() != 500) return;
        if (!ExceptionType.IsInstanceOfType(filterContext.Exception)) return;

        string controllerName = filterContext.GetController();
        string actionName = filterContext.GetAction();
        HandleErrorInfo model = new HandleErrorInfo(filterContext.Exception, controllerName, actionName);

        filterContext.Result = new ViewResult
        {
            ViewName = View,
            MasterName = Master,
            ViewData = new ViewDataDictionary<HandleErrorInfo>(model)
        };

        //使用log4net写入本地日志
        _logger.Error(filterContext.Exception.Message, filterContext.Exception);

        filterContext.HttpContext.Response.Clear();
        filterContext.HttpContext.Response.StatusCode = 500;
        filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;
        filterContext.ExceptionHandled = true;
    }
    public void OnException(ExceptionContext filterContext)
    {
        StringBuilder strBuilder = new StringBuilder("异常信息:\r\n");

        string controllerName = filterContext.GetController();
        string actionName = filterContext.GetAction();

        strBuilder.AppendFormat("\tController:{0}\r\n", controllerName);
        strBuilder.AppendFormat("\tAction:{0}\r\n", actionName);
        strBuilder.AppendFormat("\tExceptionInfo:{0}\r\n", filterContext.Exception);

        //ToTest
        //MailHelper mail = new MailHelper("smtp.gmail.com", "*****@*****.**", "gzlpsmyx");
        //mail.Send("System", "*****@*****.**", "资产系统出现错误!", strBuilder.ToString());
    }
    public override void OnException(ExceptionContext filterContext)
    {
        T_Log log = new T_Log();

        //ToTest
        log.UserId = 1;
        log.UserName = "******";

        //log.UserId = Convert.ToInt32(filterContext.HttpContext.Session["UserId"]);
        //log.UserName = filterContext.HttpContext.Session["UserName"].ToString();
        log.IpAddress = NetHelper.GetPrivateIPAddress();
        log.Controller = filterContext.GetController();
        log.Action = filterContext.GetAction();
        log.Remark = filterContext.Exception.Message;
        log.CreateDate = DateTime.Now;

        //ToTest
        //using (DBEntity db = new DBEntity())
        //{
        //    db.Log.AddObject(log);
        //    db.SaveChanges();
        //}
    }