コード例 #1
0
        protected void Application_Start(object sender, EventArgs e)
        {
            try
            {
                ApplicationController objAppController = new ApplicationController();
                if (objAppController.IsInstalled())
                {
                    SageFrameConfig pagebase = new SageFrameConfig();
                    RolesManagementController objController = new RolesManagementController();
                    RolesManagementInfo res = objController.GetRoleIDByRoleName(SystemSetting.AnonymousUsername);
                    if (res != null)
                    {
                        SystemSetting.ANONYMOUS_ROLEID = res.RoleId.ToString();
                    }
                    bool IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                    SageFrameSettingKeys.PageExtension = pagebase.GetSettingsByKey(SageFrameSettingKeys.SettingPageExtension);
                    bool isSchedulerOn = pagebase.GetSettingBollByKey(SageFrameSettingKeys.Scheduler);
                    if (IsUseFriendlyUrls)
                    {
                        RegisterRoutes(RouteTable.Routes);
                    }
                    if (isSchedulerOn)
                    {
                        RunSchedule();
                    }
                }
            }
            catch
            {
            }

        }
コード例 #2
0
 private void SetAdminParts()
 {
     HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName + "_" + GetAppPath() + "_" + GetPortalID];
     if (authCookie != null)
     {
         FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
         string user = ticket.Name;
         if (user != string.Empty && user != ApplicationKeys.anonymousUser)
         {
             divAdminControlPanel.Visible = true;
             ApplicationController objAppController = new ApplicationController();
             objAppController.ChangeCss(Page, "pchWhole", "lytA", "sfOuterWrapper", "style", "margin-top:30px");
         }
     }
     else
     {
         divAdminControlPanel.Visible = false;
     }
     if (IsHandheld())
     {
         divAdminControlPanel.Visible = false;
     }
 }
コード例 #3
0
 private void SageInitPart()
 {
     try
     {
         ApplicationController objAppController = new ApplicationController();
         if (objAppController.IsInstalled())
         {
             if (!objAppController.CheckRequestExtension(Request))
             {
                 InitializePage();
                 SageFrameConfig sfConfig = new SageFrameConfig();
                 IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                 SetAdminParts();
                 BindModuleControls();
             }
         }
         else
         {
             HttpContext.Current.Response.Redirect(ResolveUrl("~/Install/InstallWizard.aspx"));
         }
     }
     catch
     {
         //throw ex;
     }
 }
コード例 #4
0
 public void ManageSSLConnection()
 {
     ApplicationController objAppController = new ApplicationController();
     if (!objAppController.CheckRequestExtension(Request))
     {
         if (Session[SessionKeys.Ssl] == null)
         {
             Session[SessionKeys.Ssl] = "True";
             //check logic redirect to or not
             //btn click login and logout prob
             PageController objController = new PageController();
             List<SecurePageInfo> sp = objController.GetSecurePage(currentportalID, GetCurrentCulture());
             string pagename = GetPageSEOName(PagePath);
             if (pagename != "Page-Not-Found")
             {
                 if (Session[SessionKeys.pagename] != null)
                 {
                     prevpage = Session[SessionKeys.pagename].ToString();
                 }
                 if (prevpage != pagename)
                 {
                     Session[SessionKeys.pagename] = pagename;
                     for (int i = 0; i < sp.Count; i++)
                     {
                         if (pagename.ToLower() == sp[i].SecurePageName.ToString().ToLower())
                         {
                             if (bool.Parse(sp[i].IsSecure.ToString()))
                             {
                                 if (!HttpContext.Current.Request.IsSecureConnection)
                                 {
                                     if (!HttpContext.Current.Request.Url.IsLoopback) //Don't check when in development mode (i.e. localhost)
                                     {
                                         Session[SessionKeys.prevurl] = "https";
                                         Response.Redirect(Request.Url.ToString().Replace("http://", "https://"));
                                     }
                                 }
                             }
                             else
                             {
                                 Session[SessionKeys.prevurl] = "http";
                                 Response.Redirect(Request.Url.ToString().Replace("https://", "http://"));
                             }
                         }
                     }
                 }
                 else if (Session[SessionKeys.prevurl] != null)
                 {
                     if (Session[SessionKeys.prevurl].ToString() != Request.Url.ToString().Split(':')[0].ToString())
                     {
                         for (int i = 0; i < sp.Count; i++)
                         {
                             if (pagename.ToLower() == sp[i].SecurePageName.ToString().ToLower())
                             {
                                 if (bool.Parse(sp[i].IsSecure.ToString()))
                                 {
                                     if (!HttpContext.Current.Request.IsSecureConnection)
                                     {
                                         if (!HttpContext.Current.Request.Url.IsLoopback) //Don't check when in development mode (i.e. localhost)
                                         {
                                             Response.Redirect(Request.Url.ToString().Replace("http://", "https://"));
                                         }
                                     }
                                 }
                                 else
                                 {
                                     Response.Redirect(Request.Url.ToString().Replace("https://", "http://"));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #5
0
 private void SageInitPart()
 {
     ApplicationController objAppController = new ApplicationController();
     if (objAppController.IsInstalled())
     {
         if (!objAppController.CheckRequestExtension(Request))
         {
             SetPortalCofig();
             InitializePage();
             hypUpgrade.NavigateUrl = "~/Admin/sfUpgrader" + Extension;
             LoadMessageControl();
             BindModuleControls();
             SageFrameConfig sfConfig = new SageFrameConfig();
             string defaultAdminTheme = sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.DefaultAdminTheme);
             string adminSidebarPosition = sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.AdminSidebarPosition);
             rdTemplate.SelectedValue = defaultAdminTheme;
             if (adminSidebarPosition == "left")
             {
                 rdLeft.Checked = true;
                 divSideBar.Attributes.Add("class", "sideBarLeft");
             }
             else
             {
                 rdRight.Checked = true;
                 divSideBar.Attributes.Add("class", "sideBarRight");
             }
         }
     }
     else
     {
         HttpContext.Current.Response.Redirect(ResolveUrl("~/Install/InstallWizard.aspx"));
     }
 }
コード例 #6
0
 /// <summary>
 /// Initialize Culture
 /// </summary>
 protected override void InitializeCulture()
 {
     ApplicationController objAppController = new ApplicationController();
     if (objAppController.IsInstalled())
     {
         SageFrameConfig sfConf = new SageFrameConfig();
         string portalCulture = sfConf.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalDefaultLanguage);
         if (Session[SessionKeys.SageUICulture] != null)
         {
             Thread.CurrentThread.CurrentUICulture = (CultureInfo)Session[SessionKeys.SageUICulture];
         }
         else
         {
             CultureInfo newUICultureInfo = new CultureInfo(portalCulture);
             Thread.CurrentThread.CurrentUICulture = newUICultureInfo;
             Session[SessionKeys.SageUICulture] = newUICultureInfo;
         }
         if (Session[SessionKeys.SageUICulture] != null)
         {
             Thread.CurrentThread.CurrentCulture = (CultureInfo)Session[SessionKeys.SageUICulture];
         }
         else
         {
             CultureInfo newCultureInfo = new CultureInfo(portalCulture);
             Thread.CurrentThread.CurrentCulture = newCultureInfo;
             Session[SessionKeys.SageUICulture] = newCultureInfo;
         }
     }
     else
     {
         HttpContext.Current.Response.Redirect(ResolveUrl("~/Install/InstallWizard.aspx"));
     }
     base.InitializeCulture();
 }
コード例 #7
0
        protected void Session_Start(object sender, EventArgs e)
        {
            try
            {
                HttpContext.Current.Session[SessionKeys.ModuleCss] = new List<CssScriptInfo>();
                HttpContext.Current.Session[SessionKeys.ModuleJs] = new List<CssScriptInfo>();
                ApplicationController objAppController = new ApplicationController();
                if (objAppController.IsInstalled())
                {

                    HttpContext.Current.Session[SessionKeys.SageFrame_PortalID] = null;
                    Session[SessionKeys.SageFrame_PortalID] = null;
                    Session[SessionKeys.SageFrame_PortalSEOName] = null;
                    SessionTracker sessionTracker = new SessionTracker();
                    if (sessionTracker != null)
                    {                        
                        SessionLog sLog = new SessionLog();
                        sLog.SessionLogStart(sessionTracker);
                    }
                    HttpContext.Current.Session[SessionKeys.Tracker] = sessionTracker;
                }
            }
            catch
            {
            }
        }
コード例 #8
0
 public void Application_PreRequestHandlerExecute(object sender, EventArgs e)
 {
     try
     {
         ApplicationController objAppController = new ApplicationController();
         if (objAppController.IsInstalled())
         {
             if ((Context.Session != null))
             {
                 SessionTracker tracker = (SessionTracker)Session[SessionKeys.Tracker];
                 if ((tracker != null))
                 {
                     tracker.AddPage(Request.Url.ToString());
                 }
             }
         }
     }
     catch
     {
     }
 }
コード例 #9
0
 private void SageInitPart()
 {
     ApplicationController objAppController = new ApplicationController();
     if (objAppController.IsInstalled())
     {
         if (!objAppController.CheckRequestExtension(Request))
         {
             SetPortalCofig();
             InitializePage();
             LoadMessageControl();
             BindModuleControls();
         }
     }
     else
     {
         HttpContext.Current.Response.Redirect(ResolveUrl("~/Install/InstallWizard.aspx"));
     }
 }
コード例 #10
0
 private void SetPageInitPart()
 {
     ltrJQueryLibrary.Text = GetJqueryLibraryPath();
     templateFavicon = SetFavIcon(GetActiveTemplate);
     Extension = SageFrameSettingKeys.PageExtension;
     ApplicationController objAppController = new ApplicationController();
     if (!objAppController.CheckRequestExtension(Request))
     {
         SageInitPart();
     }
     SetGlobalVariable();
 }
コード例 #11
0
        private void SetPageLoadPart()
        {
            ApplicationController objAppController = new ApplicationController();
            if (!objAppController.CheckRequestExtension(Request))
            {
                //CoreJs.IncludeLanguageCoreJs(this.Page);
                SessionTrackerController sTracController = new SessionTrackerController();
                sTracController.SetSessionTrackerValues(currentportalID.ToString(), GetUsername);

            }
        }
コード例 #12
0
 private void SetAdminParts()
 {
     SecurityPolicy objSecurity = new SecurityPolicy();
     HttpCookie authCookie = Request.Cookies[objSecurity.FormsCookieName(GetPortalID)];
     if (authCookie != null)
     {
         RoleController _role = new RoleController();
         bool isDashboardAccessible = _role.IsDashboardAccesible(GetUsername, GetPortalID);
         if (isDashboardAccessible)
         {
             divAdminControlPanel.Visible = true;
             ApplicationController objAppController = new ApplicationController();
             // objAppController.ChangeCss(Page, "pchWhole", "lytA", "sfOuterWrapper", "style", "margin-top:30px");
         }
     }
     else
     {
         divAdminControlPanel.Visible = false;
     }
     if (IsHandheld())
     {
         divAdminControlPanel.Visible = false;
     }
 }
コード例 #13
0
 private void SageInitPart()
 {
     ApplicationController objAppController = new ApplicationController();
     if (objAppController.IsInstalled())
     {
         if (!objAppController.CheckRequestExtension(Request))
         {
             SetPortalCofig();
             InitializePage();
             hypUpgrade.NavigateUrl = "~/Admin/sfUpgrader" + Extension;
             SageFrameConfig sfConfig = new SageFrameConfig();
             IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
             LoadMessageControl();
             BindModuleControls();
         }
     }
     else
     {
         HttpContext.Current.Response.Redirect(ResolveUrl("~/Install/InstallWizard.aspx"));
     }
 }
コード例 #14
0
 private void SetPageInitPart()
 {
     string PageName = Path.GetFileNameWithoutExtension(PagePath);
     if (PageName != null)
     {
         userName = SecurityPolicy.GetUser(GetPortalID);
         templateFavicon = SetFavIcon(GetActiveTemplate);
         Extension = SageFrameSettingKeys.PageExtension;
         ApplicationController objAppController = new ApplicationController();
         if (!objAppController.CheckRequestExtension(Request))
         {
             SageInitPart();
         }
         SetGlobalVariable();
         bool IsAdmin = true;
         IncludeStartup(GetPortalID, pchHolder, IsAdmin);
     }
     else
     {
         Response.Redirect(PortalAPI.PageNotAccessibleURL);
     }
 }
コード例 #15
0
        void context_BeginRequest(object sender, EventArgs e)
        {
            string ext = SageFrameSettingKeys.PageExtension;

            HttpApplication AppObject = (HttpApplication)sender;

            if (!(AppObject.Request.CurrentExecutionFilePath.Contains("Templates/") ||

                     AppObject.Request.CurrentExecutionFilePath.Contains(".axd") ||
                      AppObject.Request.CurrentExecutionFilePath.Contains(".ashx") ||
                        AppObject.Request.CurrentExecutionFilePath.Contains(".asmx") ||
                          AppObject.Request.CurrentExecutionFilePath.Contains(".svc") ||
                AppObject.Request.CurrentExecutionFilePath.Contains("fonts") ||
                AppObject.Request.CurrentExecutionFilePath.Contains(".gif") ||
                AppObject.Request.CurrentExecutionFilePath.Contains(".jpg") ||
                AppObject.Request.CurrentExecutionFilePath.Contains(".js") ||
                  AppObject.Request.CurrentExecutionFilePath.Contains(".css") ||
                AppObject.Request.CurrentExecutionFilePath.Contains(".png")))
            {

                  ApplicationController objAppController = new ApplicationController();
                if (objAppController.IsInstalled())
                {

                    SageFrameConfig sfConf = new SageFrameConfig();
                    var _useSsl = sfConf.GetSettingValueByIndividualKey(SageFrameSettingKeys.UseSSL);
                    bool useSSL = string.IsNullOrEmpty(_useSsl) ? false : bool.Parse(_useSsl.ToString().ToLower());
                    string serverName = HttpUtility.UrlEncode(AppObject.Request.ServerVariables["SERVER_NAME"]);

                    string filePath = AppObject.Request.FilePath;
                    string query = AppObject.Request.Url.Query;
                    int portNo = AppObject.Request.Url.Port;
                    string redirectionUrl = "";
                    string pagename = Path.GetFileName(filePath);

                    pagename = pagename == "" ? "Home" : pagename;

                    if (pagename.ToLower().Contains("loadcontrolhandler"))
                        return;
                    if (!AppObject.Request.IsSecureConnection)
                    {
                        if (useSSL)
                        {
                            redirectionUrl = "https://" + serverName + ":" + filePath + query;
                            AppObject.Response.Redirect(redirectionUrl);
                            return;
                        }

                        // send user to SSL 
                        if (portNo != 80)
                            redirectionUrl = "https://" + serverName + ":" + portNo + filePath + query;
                        else
                            redirectionUrl = "https://" + serverName + filePath + query;

                        if (checkIsPageSecure(pagename))
                            AppObject.Response.Redirect(redirectionUrl);

                    }
                    else
                    {
                        if (useSSL)
                            return;

                        if (portNo != 443)
                            redirectionUrl = "http://" + serverName + ":" + portNo + filePath + query;
                        else
                            redirectionUrl = "http://" + serverName + filePath + query;
                        if (!checkIsPageSecure(pagename))
                            AppObject.Response.Redirect(redirectionUrl);
                    }
                }
            }


        }
コード例 #16
0
 private void SetPageLoadPart()
 {
     ApplicationController objAppController = new ApplicationController();
     if (!objAppController.CheckRequestExtension(Request))
     {
         CoreJs.IncludeLanguageCoreJs(this.Page);
         SagePageLoadPart();
     }
 }
コード例 #17
0
 protected void Application_Error(object sender, EventArgs e)
 {
     Exception ex = Server.GetLastError();
     if (null != HttpContext.Current)
     {
         string url = HttpContext.Current.Request.Url.ToString();
         ApplicationController objAppController = new ApplicationController();
         if (objAppController.IsImageRequest(url))
         {
             ErrorHandler erHandler = new ErrorHandler();
             erHandler.LogCommonException(ex);
         }
     }
 }
コード例 #18
0
 private void SetPageLoadPart()
 {
     ApplicationController objAppController = new ApplicationController();
     if (!objAppController.CheckRequestExtension(Request))
     {
         SagePageLoadPart();
         StringBuilder sb = new StringBuilder();
     }
 }
コード例 #19
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="e"></param>
 protected override void OnPreRender(EventArgs e)
 {
     ApplicationController objAppController = new ApplicationController();
     if (!objAppController.CheckRequestExtension(Request))
     {
         base.OnPreRender(e);
         SetGoogleAnalytics();
         LoadModuleCss();
         LoadModuleJs();
         HttpContext.Current.Session[SessionKeys.ModuleCss] = new List<CssScriptInfo>();
         HttpContext.Current.Session[SessionKeys.ModuleJs] = new List<CssScriptInfo>();
     }
 }
コード例 #20
0
        /// <summary>
        /// Set Cureent Template Css
        /// </summary>
        public void SetTemplateCss()
        {
            string TemplateName = GetActiveTemplate;
            string CssTemplatePath = string.Empty;
            string cssColoredTemplate = string.Empty;
            string CssLayoutPath = string.Empty;
            Literal SageFrameCoreCss = this.Page.FindControl("SageFrameCoreCss") as Literal;
            string activeTemplate = GetActiveTemplate;
            ApplicationController objAppController = new ApplicationController();
            if (objAppController.IsAdminRequest())
            {
                string adminTheme = GetActiveAdminTheme;
                CssTemplatePath = "~/Administrator/Templates/Default/css/admin.css";
                cssColoredTemplate = objAppController.CssColoredTemplate(adminTheme.ToLower());
            }
            else
            {
                string pcTemplatePath = Decide.IsTemplateDefault(activeTemplate) ? "~/Core/Template/css/template.css"
                                        : string.Format("~/Templates/{0}/css/template.css", activeTemplate);

                CssTemplatePath = !IsHandheld() ? pcTemplatePath
                                    : string.Format("~/Templates/{0}/css/handheld/template.css", activeTemplate);

                PresetInfo preset = GetPresetDetails;
                if (preset.ActiveTheme != "" && preset.ActiveTheme.ToLower() != "default")
                {
                    cssColoredTemplate = cssColorTemplate(activeTemplate, preset);
                }
            }
            if (!Decide.IsTemplateDefault(activeTemplate) && !IsAdmin() && !IsHandheld())
            {
                if (SageFrameCoreCss != null)
                {
                    // SageFrameCoreCss.Text += "<link href=\"" + Page.ResolveUrl("~/Administrator/Templates/Default/css/front.css") + "\" rel=\"stylesheet\" type=\"text/css\" />";
                }
            }
            StringBuilder coreCss = new StringBuilder();
            if (!IsAdmin() && !IsHandheld())
            {
                if (SageFrameCoreCss != null)
                {
                    coreCss.Append("<link href=\"" + Page.ResolveUrl("~/Administrator/Templates/Default/css/front.css") + "\" rel=\"stylesheet\" type=\"text/css\" />");
                }
            }
            if (SageFrameCoreCss != null)
            {
                if (!IsHandheld())
                {
                    coreCss.Append("<link href=\"" + Page.ResolveUrl("~/Administrator/Templates/Default/css/core.css") + "\" rel=\"stylesheet\" type=\"text/css\" />");
                }
                coreCss.Append("<link href=\"" + Page.ResolveUrl(CssTemplatePath) + "\" rel=\"stylesheet\" type=\"text/css\" />");
                coreCss.Append("<link href=\"" + Page.ResolveUrl(cssColoredTemplate) + "\" rel=\"stylesheet\" type=\"text/css\" />");
                SageFrameCoreCss.Text += coreCss.ToString();
            }
        }
コード例 #21
0
        /// <summary>
        /// Set Current Screen Width Parse From Preset XML File
        /// </summary>      

        public void SetScreenWidth(string userName)
        {
            string appendClass = " sfLoggedTopBar";
            if (userName.ToLower() == "anonymoususer")
            {
                appendClass = "";
            }
            PresetInfo preset = GetPresetDetails;
            if (preset.ActiveWidth != "")
            {
                ApplicationController objAppController = new ApplicationController();
                objAppController.ChangeCss(Page, "pchWhole", "lytA", "sfOuterWrapper", "class", "sf" + preset.ActiveWidth.ToLower() + appendClass);
            }
        }
コード例 #22
0
 /// <summary>
 /// Set Current Screen Width Parse From Preset XML File
 /// </summary>
 public void SetScreenWidth()
 {
     PresetInfo preset = GetPresetDetails;
     if (preset.ActiveWidth != "")
     {
         ApplicationController objAppController = new ApplicationController();
         objAppController.ChangeCss(Page, "pchWhole", "lytA", "sfOuterWrapper", "class", "sf" + preset.ActiveWidth.ToLower());
     }
 }
コード例 #23
0
 /// <summary>
 /// Executes on prerendering of the page
 /// </summary>
 /// <param name="e">EventArgs e</param>
 protected override void OnPreRender(EventArgs e)
 {
     try
     {
         ApplicationController objAppController = new ApplicationController();
         if (!objAppController.CheckRequestExtension(Request))
         {
             base.OnPreRender(e);
             SetGoogleAnalytics();
             SageFrameConfig objSageConfig = new SageFrameConfig();
             bool IsCompressCss = bool.Parse(objSageConfig.GetSettingsByKeyIndividual(SageFrameSettingKeys.OptimizeCss));
             bool allowOptimization = bool.Parse(objSageConfig.GetSettingsByKeyIndividual(SageFrameSettingKeys.OptimizeJs));
             if (!isDefaultAdminPage())
             {
                 if (IsCompressCss)
                 {
                     BundleCss();
                 }
                 else
                 {
                     LoadModuleCss();
                 }
             }
             if (!IsAdmin() && allowOptimization)
             {
                 BundleJS();
             }
             else
             {
                 LoadModuleJs();
             }
             HttpContext.Current.Session[SessionKeys.ModuleCss] = new List<CssScriptInfo>();
             HttpContext.Current.Session[SessionKeys.ModuleJs] = new List<CssScriptInfo>();
             HttpContext.Current.Session.Remove(SessionKeys.ModuleJs);
             HttpContext.Current.Session.Remove(SessionKeys.ModuleCss);
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
コード例 #24
0
        private void SetPageInitPart()
        {
            ltrJQueryLibrary.Text = GetAdminJqueryLibraryPath();
            CheckUserLogin();
            string PageName = Path.GetFileNameWithoutExtension(PagePath);
            //adminImage.ImageUrl = GetUserImage;
            if (PageName != null)
            {
                SecurityPolicy objSecurity = new SecurityPolicy();

                userName = objSecurity.GetUser(GetPortalID);
                templateFavicon = SetFavIcon(GetActiveTemplate);
                Extension = SageFrameSettingKeys.PageExtension;
                ApplicationController objAppController = new ApplicationController();
                objSecurity.UpdateExpireTime(userName, GetPortalID);
                if (!objAppController.CheckRequestExtension(Request))
                {
                    SageInitPart();
                }
                SetGlobalVariable();
                bool IsAdmin = true;
                IncludeStartup(GetPortalID, pchHolder, IsAdmin);
            }
            else
            {
                Response.Redirect(PortalAPI.PageNotAccessibleURL);
            }
        }