コード例 #1
0
ファイル: MrCMSApplication.cs プロジェクト: xubinvc/MrCMS
        protected void Application_Start()
        {
            MrCMSApp.RegisterAllApps();
            AreaRegistration.RegisterAllAreas(MrCMSKernel.Kernel);
            MrCMSRouteRegistration.Register(RouteTable.Routes);

            RegisterServices(MrCMSKernel.Kernel);
            MrCMSApp.RegisterAllServices(MrCMSKernel.Kernel);

            LegacySettingMigrator.MigrateSettings(MrCMSKernel.Kernel);
            LegacyTemplateMigrator.MigrateTemplates(MrCMSKernel.Kernel);

            SetModelBinders();

            SetViewEngines();

            BundleRegistration.Register(MrCMSKernel.Kernel);

            ControllerBuilder.Current.SetControllerFactory(new MrCMSControllerFactory());

            GlobalFilters.Filters.Add(new HoneypotFilterAttribute());

            ModelMetadataProviders.Current = new MrCMSMetadataProvider(MrCMSKernel.Kernel);

            ImagePluginInstaller.Install();

            MiniProfiler.Settings.Results_Authorize      = MiniProfilerAuth.IsUserAllowedToSeeMiniProfilerUI;
            MiniProfiler.Settings.Results_List_Authorize = MiniProfilerAuth.IsUserAllowedToSeeMiniProfilerUI;


            OnApplicationStart();
        }
コード例 #2
0
        protected void Application_Start()
        {
            MrCMSApp.RegisterAllApps();
            AreaRegistration.RegisterAllAreas(MrCMSKernel.Kernel);
            MrCMSRouteRegistration.Register(RouteTable.Routes);

            RegisterServices(MrCMSKernel.Kernel);
            MrCMSApp.RegisterAllServices(MrCMSKernel.Kernel);

            LegacySettingMigrator.MigrateSettings(MrCMSKernel.Kernel);
            LegacyTemplateMigrator.MigrateTemplates(MrCMSKernel.Kernel);

            SetModelBinders();

            SetViewEngines();

            BundleRegistration.Register(MrCMSKernel.Kernel);

            ControllerBuilder.Current.SetControllerFactory(new MrCMSControllerFactory());

            GlobalFilters.Filters.Add(new HoneypotFilterAttribute());

            ModelMetadataProviders.Current = new MrCMSMetadataProvider(MrCMSKernel.Kernel);

            ImagePluginInstaller.Install();

            MiniProfiler.Settings.Results_Authorize      = MiniProfilerAuth.IsUserAllowedToSeeMiniProfilerUI;
            MiniProfiler.Settings.Results_List_Authorize = MiniProfilerAuth.IsUserAllowedToSeeMiniProfilerUI;


            OnApplicationStart();
            var webRootPath = Server.MapPath("~");
            var docPath     = Path.GetFullPath(Path.Combine(webRootPath, "../Count_Visited.txt"));

            //Kiểm tra nếu chưa tồn tại file thì tạo file Count_Visited.txt
            if (!File.Exists(docPath))
            {
                File.WriteAllText(docPath, "0");
            }
            Application["DaTruyCap"] = int.Parse(File.ReadAllText(docPath));
        }