示例#1
0
        protected void Application_Start()
        {
            string configurationFolder = HttpContext.Current.Server.MapPath(string.Concat("\\Configuration\\"));

            log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(configurationFolder + "Log4Net.config"));
            Log.Debug("Application_Start");

            InitializeUiConfigurationManager(configurationFolder);

            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            //for watching updated config file.
            AddFileWatcher(configurationFolder, "watcher", () =>
            {
                if (isWatcherUpdate)
                {
                    InitializeUiConfigurationManager(configurationFolder);
                }
            });

            Log.Debug("Application_Start end");
        }
示例#2
0
        public ImageResult(ControllerContext context, Bitmap bmp)
        {
            context.Controller.TempData.Clear();
            try
            {
                context.HttpContext.Response.ContentType = "image/gif";
                bmp.Save(context.HttpContext.Response.OutputStream, ImageFormat.Gif);
            }
            catch (Exception ex)
            {
                Log.Debug(ex.Message);
                Log.Debug(ex.StackTrace);
            }

            bmp.Dispose();
        }
示例#3
0
        /// <summary>
        /// BasePage Init Event
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

#if DEBUG
            if (LogonUser == null)
            {
                SysLog.Debug(bugService);
                SysLog.Debug(bugTrackService);
                SysLog.Debug(projectService);
                SysLog.Debug(taskService);
                SysLog.Debug(taskTrackService);

                LogonUser = Application.GetContainer().Resolve <IUserService>().GetById(1);
            }
#endif
            if (LogonUser == null)
            {
                //ShowMessage("请登录", "Default.aspx");
                //ScriptRedirect("Login.aspx");
                //Response.Redirect("~/Login.aspx?url=" + Request.RawUrl, true);
            }
            //if (LogonUser.RoleName.Equals(MyRabbit.Entity.UserRole.Designer)
            //    || LogonUser.Role.Equals(MyRabbit.Entity.UserRole.Operator)
            //    || LogonUser.Role.Equals(MyRabbit.Entity.UserRole.Salesman)) {
            //        Response.Redirect("~/Default.aspx", true);
            //}
        }
示例#4
0
 protected override void OnAuthorization(AuthorizationContext filterContext)
 {
     if (ControllerPermision != Permission.Public)
     {
         if (sessionData.trading != null)
         {
             if (string.IsNullOrEmpty(sessionData.trading.LoginId))
             {
                 Log.Debug("Session Lost");
                 RejectRequestResult.RejectRequest(filterContext, RejectReason.SessionLost, sessionData);
             }
         }
         else
         {
             Log.Debug("Session Lost");
             RejectRequestResult.RejectRequest(filterContext, RejectReason.SessionLost, sessionData);
         }
     }
 }