示例#1
0
        protected override void OnException(ExceptionContext exceptionContext)
        {
            promotalkEntities db = new promotalkEntities();

            if (!exceptionContext.ExceptionHandled)
            {
                AppErrorLog oAppErrorLogs = new AppErrorLog();
                oAppErrorLogs.ErrorMsg = exceptionContext.Exception.Message;
                ViewBag.msg            = exceptionContext.Exception.Message;
                oAppErrorLogs.datelog  = BaseUtil.GetCurrentDateTime();
                db.AppErrorLogs.Add(oAppErrorLogs);
                db.SaveChanges();
                exceptionContext.ExceptionHandled = true;
                Response.Redirect("~/Views/Shared/Error.cshtml");
            }
        }
示例#2
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            String ControllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToUpper();
            String ActionName     = filterContext.ActionDescriptor.ActionName.ToUpper();
            String Action         = string.Format("{0}Controller{1}", ControllerName, ActionName).ToUpper();

            if (BaseUtil.ListControllerTocheckLogin().Contains(ControllerName))
            {
                if (BaseUtil.GetSessionValue(AdminInfo.LoginID.ToString()) == "")
                {
                    filterContext.Result = null;
                    filterContext.Result = new RedirectResult("/Account/login");
                    return;
                }
                return;
            }
        }
示例#3
0
 public static string GetLoginID()
 {
     return(BaseUtil.GetSessionValue(AdminInfo.LoginID.ToString()));
 }
示例#4
0
 public static int GetUserID()
 {
     return(Convert.ToInt32(BaseUtil.GetSessionValue(AdminInfo.LoginID.ToString())));
 }