Example #1
0
        public void Page_PreInit(object sender, EventArgs e)
        {
            var httpRuntimeSection = new System.Web.Configuration.HttpRuntimeSection();
            var settings           = GetSettings();

            if (settings.MaxRequestLength > 0)
            {
                httpRuntimeSection.MaxRequestLength = settings.MaxRequestLength;
            }

            WebFormHelper.ClearIncludesList();
            PreloadHelper.PreloadList.Clear();

            if (AppSettings.UseLoadFileServiceUrl)
            {
                WebFormHelper.LoadFileServiceUrl = AppSettings.FileServiceHandlerUrl + AppSettings.LoadFileUriSegment;
            }
            else
            {
                WebFormHelper.LoadFileServiceUrl = "";
            }

            WebFormHelper.CombineCssAndJsIncludes = AppSettings.CombineCssAndJsIncludes;

            if (Request["action"] != null)
            {
                switch (Request["action"].ToLower())
                {
                case "clearcache":
                    ContextHelper.ClearAllMemoryCache();
                    break;

                case "logout":
                    FormsAuthentication.SignOut();
                    break;
                }
            }

            if (this.MasterPageFile != null)
            {
                var masterFilePath = GetMasterPageFilePath();

                if (File.Exists(URIHelper.ConvertToAbsPath(masterFilePath)))
                {
                    MasterPageFile = masterFilePath;
                }
                else
                {
                    MasterPageFile = "";
                }
            }

            if (currentPageVirtualPath == "")
            {
                currentPageVirtualPath = URIHelper.GetCurrentVirtualPath();
            }

            if (FrameworkSettings.Current?.CurrentMediaDetail == null)
            {
                return;
            }

            if (currentPageVirtualPath == "")
            {
                currentPageVirtualPath = URIHelper.GetCurrentVirtualPath();
            }

            if (!CanAccessSection())
            {
                FormsAuthentication.RedirectToLoginPage();
                return;
            }
        }