コード例 #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// LoadContainerByPath gets the Container from its Url(Path)
        /// </summary>
        /// <param name="containerPath">The Url to the Container control</param>
        /// <returns>A Container</returns>
        /// -----------------------------------------------------------------------------
        private Containers.Container LoadContainerByPath(string containerPath)
        {
            if (containerPath.ToLower().IndexOf("/skins/") != -1 || containerPath.ToLower().IndexOf("/skins\\") != -1 || containerPath.ToLower().IndexOf("\\skins\\") != -1 ||
                containerPath.ToLower().IndexOf("\\skins/") != -1)
            {
                throw new Exception();
            }

            Containers.Container container = null;

            try
            {
                string containerSrc = containerPath;
                if (containerPath.IndexOf(Globals.ApplicationPath, StringComparison.InvariantCultureIgnoreCase) != -1)
                {
                    containerPath = containerPath.Remove(0, Globals.ApplicationPath.Length);
                }
                container = ControlUtilities.LoadControl <Containers.Container>(PaneControl.Page, containerPath);
                container.ContainerSrc = containerSrc;
                //call databind so that any server logic in the container is executed
                container.DataBind();
            }
            catch (Exception exc)
            {
                //could not load user control
                var lex = new ModuleLoadException(Skin.MODULELOAD_ERROR, exc);
                if (TabPermissionController.CanAdminPage())
                {
                    //only display the error to administrators
                    _containerWrapperControl.Controls.Add(new ErrorContainer(PortalSettings, string.Format(Skin.CONTAINERLOAD_ERROR, containerPath), lex).Container);
                }
                Exceptions.LogException(lex);
            }
            return(container);
        }
コード例 #2
0
 private Containers.Container LoadContainerByPath(string ContainerPath)
 {
     if (ContainerPath.ToLower().IndexOf("/skins/") != -1 || ContainerPath.ToLower().IndexOf("/skins\\") != -1 || ContainerPath.ToLower().IndexOf("\\skins\\") != -1 || ContainerPath.ToLower().IndexOf("\\skins/") != -1)
     {
         throw new System.Exception();
     }
     Containers.Container ctlContainer = null;
     try
     {
         string ContainerSrc = ContainerPath;
         if (ContainerPath.IndexOf(Common.Globals.ApplicationPath, StringComparison.InvariantCultureIgnoreCase) != -1)
         {
             ContainerPath = ContainerPath.Remove(0, Common.Globals.ApplicationPath.Length);
         }
         ctlContainer = ControlUtilities.LoadControl <Containers.Container>(PaneControl.Page, ContainerPath);
         ctlContainer.ContainerSrc = ContainerSrc;
         ctlContainer.DataBind();
     }
     catch (Exception exc)
     {
         ModuleLoadException lex = new ModuleLoadException(Skin.MODULELOAD_ERROR, exc);
         if (TabPermissionController.CanAdminPage())
         {
             PaneControl.Controls.Add(new ErrorContainer(PortalSettings, string.Format(Skin.CONTAINERLOAD_ERROR, ContainerPath), lex).Container);
         }
         Exceptions.LogException(lex);
     }
     return(ctlContainer);
 }