コード例 #1
0
    protected void Page_Init(object sender, EventArgs e)
    {
        /*
         * Set the browsing mode cookie.
         */
        string mode = Request.QueryString["mode"];

        if (String.IsNullOrEmpty(mode))
        {
            CookieHandler.Set("mode", "operate");
        }
        else
        {
            CookieHandler.Set("mode", mode == "develop" ? "develop" : "operate");
        }

        /*
         * Set the version cookie. If version doesn't match
         * last session version, redirect to upgraded page.
         */
        string nowversion = Composite.RuntimeInformation.ProductVersion.ToString();

        bool isUpdated = false;

        if (CookieHandler.Get("CompositeVersionString") != null)
        {
            string oldversion = CookieHandler.Get("CompositeVersionString");
            if (nowversion != oldversion)
            {
                var installationAge = DateTime.Now - SystemSetupFacade.GetFirstTimeStart();
                isUpdated = installationAge.TotalMinutes > 5;
            }
        }

        CookieHandler.Set("CompositeVersionString", nowversion, DateTime.Now.AddYears(23));

        if ((RuntimeInformation.IsDebugBuild == false) && (isUpdated == true))
        {
            string url = "updated.aspx";
            if (CookieHandler.Get("mode") == "develop")
            {
                url += "?mode=develop"; // TODO: copy entire querystring (no intellisense here)!
            }
            Response.Redirect(url);
        }
    }
コード例 #2
0
        /// <exclude />
        public static void Application_Start(object sender, EventArgs e)
        {
            _startTime = DateTime.Now;
            if (RuntimeInformation.IsDebugBuild)
            {
                Log.LogInformation(_verboseLogEntryTitle, "AppDomain {0} started at {1} in process {2}", AppDomain.CurrentDomain.Id, _startTime.ToString("HH:mm:ss:ff"), Process.GetCurrentProcess().Id);
            }

            SystemSetupFacade.SetFirstTimeStart();

            InitializeServices();

            if (!SystemSetupFacade.IsSystemFirstTimeInitialized)
            {
                return;
            }

            if (_systemIsInitialized)
            {
                return;
            }

            if (AppDomain.CurrentDomain.BaseDirectory.Length > GlobalSettingsFacade.MaximumRootPathLength)
            {
                throw new InvalidOperationException("Windows limitation problem detected! You have installed the website at a place where the total path length of the file with the longest filename exceeds the maximum allowed in Windows. See http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx#paths");
            }


            AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;

            lock (_syncRoot)
            {
                if (_systemIsInitialized)
                {
                    return;
                }

                ApplicationStartInitialize(RuntimeInformation.IsDebugBuild);

                _systemIsInitialized = true;
            }
        }