コード例 #1
0
ファイル: Exceptions.cs プロジェクト: yog-it/Dnn.Platform
        /// <summary>
        /// Logs the SecurityException.
        /// </summary>
        /// <param name="exc">The exc.</param>
        public static void LogException(SecurityException exc)
        {
            Logger.Error(exc);
            var objExceptionLog = new ExceptionLogController();

            objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.SECURITY_EXCEPTION);
        }
コード例 #2
0
        /// <summary>
        /// Logs the PageLoadException.
        /// </summary>
        /// <param name="exc">The exc.</param>
        public static void LogException(PageLoadException exc)
        {
            Logger.Error(exc);
            var objExceptionLog = new ExceptionLogController();

            objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.PAGE_LOAD_EXCEPTION);
        }
コード例 #3
0
        /// <summary>
        /// Logs the SchedulerException.
        /// </summary>
        /// <param name="exc">The exc.</param>
        public static void LogException(SchedulerException exc)
        {
            Logger.Error(exc);
            var objExceptionLog = new ExceptionLogController();

            objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.SCHEDULER_EXCEPTION);
        }
コード例 #4
0
        /// <summary>
        /// Processes the page load exception.
        /// </summary>
        /// <param name="exc">The exc.</param>
        /// <param name="URL">The URL.</param>
        public static void ProcessPageLoadException(Exception exc, string URL)
        {
            Logger.Error(URL, exc);
            if (ThreadAbortCheck(exc))
            {
                return;
            }
            PortalSettings _portalSettings = PortalController.Instance.GetCurrentPortalSettings();

            if (!Host.UseCustomErrorMessages)
            {
                throw new PageLoadException((exc == null ? "" : exc.Message), exc);
            }
            else
            {
                var lex = new PageLoadException((exc == null ? "" : exc.Message), exc);
                //publish the exception
                var objExceptionLog = new ExceptionLogController();
                objExceptionLog.AddLog(lex);
                if (!String.IsNullOrEmpty(URL))
                {
                    //redirect
                    if (URL.IndexOf("error=terminate") != -1)
                    {
                        HttpContext.Current.Response.Clear();
                        HttpContext.Current.Server.Transfer("~/ErrorPage.aspx");
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect(URL, true);
                    }
                }
            }
        }
コード例 #5
0
ファイル: Exceptions.cs プロジェクト: yog-it/Dnn.Platform
        /// <summary>
        /// Logs the search exception.
        /// </summary>
        /// <param name="exc">The exc.</param>
        public static void LogSearchException(SearchException exc)
        {
            Logger.Error(exc);
            var objExceptionLog = new ExceptionLogController();

            objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.SEARCH_INDEXER_EXCEPTION);
        }
コード例 #6
0
ファイル: Exceptions.cs プロジェクト: yog-it/Dnn.Platform
        /// <summary>
        /// Logs all the basic exception.
        /// </summary>
        /// <param name="exc">The exc.</param>
        public static void LogException(Exception exc)
        {
            Logger.Error(exc);
            var objExceptionLog = new ExceptionLogController();

            objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.GENERAL_EXCEPTION);
        }
コード例 #7
0
        /// <summary>Called when a module is upgraded.</summary>
        /// <param name="version">The version.</param>
        /// <returns>Success if all goes well, otherwise, Failed</returns>
        public string UpgradeModule(string version)
        {
            try
            {
                switch (version)
                {
                case "07.04.00":
                    const string ResourceFile    = ModuleFolder + "/App_LocalResources/ProviderConfiguration.ascx.resx";
                    string       pageName        = Localization.GetString("HTMLEditorPageName", ResourceFile);
                    string       pageDescription = Localization.GetString("HTMLEditorPageDescription", ResourceFile);

                    // Create HTML Editor Config Page (or get existing one)
                    TabInfo editorPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/HtmlEditorManager_Standard_16x16.png", ModuleFolder + "/images/HtmlEditorManager_Standard_32x32.png", false);

                    // Find the RadEditor control and remove it
                    Upgrade.RemoveModule("RadEditor Manager", editorPage.TabName, editorPage.ParentId, false);

                    // Add Module To Page
                    int moduleDefId = this.GetModuleDefinitionID("DotNetNuke.HtmlEditorManager", "Html Editor Management");
                    Upgrade.AddModuleToPage(editorPage, moduleDefId, pageName, ModuleFolder + "/images/HtmlEditorManager_Standard_32x32.png", true);

                    foreach (var item in DesktopModuleController.GetDesktopModules(Null.NullInteger))
                    {
                        DesktopModuleInfo moduleInfo = item.Value;

                        if (moduleInfo.ModuleName == "DotNetNuke.HtmlEditorManager")
                        {
                            moduleInfo.Category = "Host";
                            DesktopModuleController.SaveDesktopModule(moduleInfo, false, false);
                        }
                    }

                    break;

                case "09.01.01":
                    if (RadEditorProviderInstalled())
                    {
                        UpdateRadCfgFiles();
                    }
                    if (TelerikAssemblyExists())
                    {
                        UpdateWebConfigFile();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                var xlc = new ExceptionLogController();
                xlc.AddLog(ex);

                return("Failed");
            }

            return("Success");
        }
コード例 #8
0
        public void OnErrorRequest(object s, EventArgs e)
        {
            HttpContext       Context = HttpContext.Current;
            HttpServerUtility Server  = Context.Server;

            Exception lex = new Exception("Unhandled Error: ", Server.GetLastError());
            ExceptionLogController objExceptionLog = new ExceptionLogController();

            objExceptionLog.AddLog(lex);
        }
コード例 #9
0
        private static void UpdateRadCfgFiles(string folder, string mask)
        {
            var allowedDocExtensions = "doc|docx|xls|xlsx|ppt|pptx|pdf|txt".Split('|');

            var files = Directory.GetFiles(folder, mask);

            foreach (var fname in files)
            {
                if (fname.Contains(".Original.xml"))
                {
                    continue;
                }

                try
                {
                    var doc = new XmlDocument {
                        XmlResolver = null
                    };
                    doc.Load(fname);
                    var root       = doc.DocumentElement;
                    var docFilters = root?.SelectNodes("/configuration/property[@name='DocumentsFilters']");
                    if (docFilters != null)
                    {
                        var changed = false;
                        foreach (XmlNode filter in docFilters)
                        {
                            if (filter.InnerText == "*.*")
                            {
                                changed         = true;
                                filter.InnerXml = "";
                                foreach (var extension in allowedDocExtensions)
                                {
                                    var node = doc.CreateElement("item");
                                    node.InnerText = "*." + extension;
                                    filter.AppendChild(node);
                                }
                            }
                        }

                        if (changed)
                        {
                            File.Copy(fname, fname + ".bak.resources", true);
                            doc.Save(fname);
                        }
                    }
                }
                catch (Exception ex)
                {
                    var xlc = new ExceptionLogController();
                    xlc.AddLog(ex);
                }
            }
        }
コード例 #10
0
        public static void ProcessModuleLoadException(string FriendlyMessage, PortalModuleBase ctrlModule, Exception exc, bool DisplayErrorMessage)
        {
            if (ThreadAbortCheck(exc))
            {
                return;
            }
            PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();

            try
            {
                if (Convert.ToString(Globals.HostSettings["UseCustomErrorMessages"]) == "N")
                {
                    throw (new ModuleLoadException(FriendlyMessage, exc));
                }
                else
                {
                    ModuleLoadException lex = new ModuleLoadException(exc.Message.ToString(), exc, ctrlModule.ModuleConfiguration);
                    //publish the exception

                    ExceptionLogController objExceptionLog = new ExceptionLogController();
                    objExceptionLog.AddLog(lex);

                    //Some modules may want to suppress an error message
                    //and just log the exception.
                    if (DisplayErrorMessage)
                    {
                        PlaceHolder ErrorPlaceholder = null;
                        if (ctrlModule.Parent != null)
                        {
                            ErrorPlaceholder = (PlaceHolder)ctrlModule.Parent.FindControl("MessagePlaceHolder");
                        }
                        if (ErrorPlaceholder != null)
                        {
                            //hide the module
                            ctrlModule.Visible       = false;
                            ErrorPlaceholder.Visible = true;
                            ErrorPlaceholder.Controls.Add(new ErrorContainer(_portalSettings, FriendlyMessage, lex).Container);     //add the error message to the error placeholder
                        }
                        else
                        {
                            //there's no ErrorPlaceholder, add it to the module's control collection
                            ctrlModule.Controls.Add(new ErrorContainer(_portalSettings, FriendlyMessage, lex).Container);
                        }
                    }
                }
            }
            catch (Exception exc2)
            {
                ProcessPageLoadException(exc2);
            }
        }
コード例 #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Version"></param>
        /// <returns></returns>
        /// <remarks>This is not localizing Page Name or description.</remarks>
        public string UpgradeModule(string Version)
        {
            try
            {
                switch (Version)
                {
                case "06.00.00":
                    string resourceFile    = ModuleFolder + "/App_LocalResources/ProviderConfig.ascx.resx";
                    string pageName        = Localization.GetString("HTMLEditorPageName", resourceFile);
                    string pageDescription = Localization.GetString("HTMLEditorPageDescription", resourceFile);

                    //Create Rad Editor Config Page (or get existing one)
                    TabInfo newPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/radeditor_config_small.png", ModuleFolder + "/images/radeditor_config_large.png", true);

                    //Add Module To Page
                    int moduleDefId = GetModuleDefinitionID();
                    Upgrade.AddModuleToPage(newPage, moduleDefId, pageName, ModuleFolder + "/images/radeditor_config_large.png", true);

                    foreach (var item in DesktopModuleController.GetDesktopModules(Null.NullInteger))
                    {
                        DesktopModuleInfo moduleInfo = item.Value;

                        if (moduleInfo.ModuleName == "DotNetNuke.RadEditorProvider")
                        {
                            moduleInfo.Category = "Host";
                            DesktopModuleController.SaveDesktopModule(moduleInfo, false, false);
                        }
                    }
                    break;

                case "07.00.06":
                    UpdateConfigOfLinksType();
                    break;

                case "07.03.00":
                    UpdateConfigFilesName();
                    UpdateToolsFilesName();
                    break;
                }
            }
            catch (Exception ex)
            {
                ExceptionLogController xlc = new ExceptionLogController();
                xlc.AddLog(ex);

                return("Failed");
            }

            return("Success");
        }
コード例 #12
0
ファイル: ExceptionModule.cs プロジェクト: misterPaul0/Curt
        public void OnErrorRequest(object s, EventArgs e)
        {
            try
            {
                if (HttpContext.Current == null)
                {
                    return;
                }

                HttpContext       Context = HttpContext.Current;
                HttpServerUtility Server  = Context.Server;
                HttpRequest       Request = Context.Request;

                //exit if a request for a .net mapping that isn't a content page is made i.e. axd
                if (Request.Url.LocalPath.ToLower().EndsWith(".aspx") == false && Request.Url.LocalPath.ToLower().EndsWith(".asmx") == false &&
                    Request.Url.LocalPath.ToLower().EndsWith(".ashx") == false)
                {
                    return;
                }
                Exception lastException = Server.GetLastError();

                //HttpExceptions are logged elsewhere
                if (!(lastException is HttpException))
                {
                    var lex             = new Exception("Unhandled Error: ", Server.GetLastError());
                    var objExceptionLog = new ExceptionLogController();
                    try
                    {
                        objExceptionLog.AddLog(lex);
                    }
                    catch (Exception ex)
                    {
                        DnnLog.Error(ex);
                    }
                }
            }
            catch (Exception exc)
            {
                //it is possible when terminating the request for the context not to exist
                //in this case we just want to exit since there is nothing else we can do
                DnnLog.Error(exc);
            }
        }
コード例 #13
0
        /// <summary>
        /// Called when error handling is requested.
        /// </summary>
        /// <param name="s">The object with the error</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        public void OnErrorRequest(object s, EventArgs e)
        {
            try
            {
                if (HttpContext.Current == null)
                {
                    return;
                }

                HttpContext       contxt  = HttpContext.Current;
                HttpServerUtility srver   = contxt.Server;
                HttpRequest       request = contxt.Request;

                if (!Initialize.ProcessHttpModule(request, false, false))
                {
                    return;
                }

                Exception lastException = srver.GetLastError();

                //HttpExceptions are logged elsewhere
                if (!(lastException is HttpException))
                {
                    var lex             = new Exception("Unhandled Error: ", srver.GetLastError());
                    var objExceptionLog = new ExceptionLogController();
                    try
                    {
                        objExceptionLog.AddLog(lex);
                    }
                    catch (Exception ex)
                    {
                        Logger.Error(ex);
                    }
                }
            }
            catch (Exception exc)
            {
                //it is possible when terminating the request for the context not to exist
                //in this case we just want to exit since there is nothing else we can do
                Logger.Error(exc);
            }
        }
コード例 #14
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// Page_Load runs when the control is loaded
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <history>
 /// </history>
 /// -----------------------------------------------------------------------------
 protected void Page_Load(System.Object sender, System.EventArgs e)
 {
     try
     {
         lErrorText.Text = "";
         if (!Page.IsPostBack && !Page.IsCallback)
         {
             atiStepSelect.Src = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/stepSelect.png");
             if (string.IsNullOrEmpty((string)Settings["LandingPage"]))
             {
                 ShowError("WARNING: No Landing Page set.  Contact Administrator");
             }
             //CATALooK.ProductsDB productDB = new CATALooK.ProductsDB();
             //string product = productDB.GetProductbyProductID(Convert.ToInt32(Settings["ProductId"]), PortalId);
             //if (product == null || product.Equals(string.Empty))
             //{
             //    throw new Exception("No Monthly Membership Product Setup. Contact Administrator");
             //}
             if (Request["r"] != null && !Request["r"].Equals(string.Empty))
             {
                 int rid = Convert.ToInt32(Request["r"]);
                 DotNetNuke.Entities.Users.UserInfo user = DotNetNuke.Entities.Users.UserController.GetUser(PortalId, rid, true, true);
                 if (user != null)
                 {
                     Session["AffiliateId"] = rid;
                     Request.Cookies.Add(new HttpCookie("AffiliateId", Convert.ToString(rid)));
                 }
                 else
                 {
                     // TODO: log this
                     DotNetNuke.Services.Log.EventLog.ExceptionLogController exLogController = new ExceptionLogController();
                     exLogController.AddLog(new Exception("User linked to site with affliate id of a non existant user"), ExceptionLogController.ExceptionLogType.GENERAL_EXCEPTION);
                 }
             }
         }
     }
     catch (Exception exc) //Module failed to load
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }
コード例 #15
0
        public string UpgradeModule(string Version)
        {
            try
            {
                switch (Version)
                {
                case "07.00.06":
                    UpdateDisplaySearchSettings();
                    break;
                }
            }
            catch (Exception ex)
            {
                ExceptionLogController xlc = new ExceptionLogController();
                xlc.AddLog(ex);

                return("Failed");
            }

            return("Success");
        }
コード例 #16
0
        public static void ProcessSchedulerException(Exception exc)
        {
            ExceptionLogController objExceptionLog = new ExceptionLogController();

            objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.SCHEDULER_EXCEPTION);
        }
コード例 #17
0
        /// <summary>
        /// Processes the module load exception.
        /// </summary>
        /// <param name="FriendlyMessage">The friendly message.</param>
        /// <param name="ctrl">The CTRL.</param>
        /// <param name="exc">The exc.</param>
        /// <param name="DisplayErrorMessage">if set to <c>true</c> display error message.</param>
        public static void ProcessModuleLoadException(string FriendlyMessage, Control ctrl, Exception exc, bool DisplayErrorMessage)
        {
            Instrumentation.DnnLog.MethodEntry();
            //Exit Early if ThreadAbort Exception
            if (ThreadAbortCheck(exc))
            {
                return;
            }
            PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();

            try
            {
                if (!Host.UseCustomErrorMessages)
                {
                    throw new ModuleLoadException(FriendlyMessage, exc);
                }
                else
                {
                    var ctrlModule          = ctrl as IModuleControl;
                    ModuleLoadException lex = null;
                    if (ctrlModule == null)
                    {
                        lex = new ModuleLoadException(exc.Message, exc);
                    }
                    else
                    {
                        lex = new ModuleLoadException(exc.Message, exc, ctrlModule.ModuleContext.Configuration);
                    }
                    //publish the exception
                    var objExceptionLog = new ExceptionLogController();
                    objExceptionLog.AddLog(lex);
                    //Some modules may want to suppress an error message
                    //and just log the exception.
                    if (DisplayErrorMessage)
                    {
                        PlaceHolder ErrorPlaceholder = null;
                        if (ctrl.Parent != null)
                        {
                            ErrorPlaceholder = (PlaceHolder)ctrl.Parent.FindControl("MessagePlaceHolder");
                        }
                        if (ErrorPlaceholder != null)
                        {
                            //hide the module
                            ctrl.Visible             = false;
                            ErrorPlaceholder.Visible = true;
                            ErrorPlaceholder.Controls.Add(new ErrorContainer(_portalSettings, FriendlyMessage, lex).Container);
                        }
                        else
                        {
                            //there's no ErrorPlaceholder, add it to the module's control collection
                            ctrl.Controls.Add(new ErrorContainer(_portalSettings, FriendlyMessage, lex).Container);
                        }
                    }
                }
            }
            catch (Exception exc2)
            {
                Instrumentation.DnnLog.Fatal(exc2);
                ProcessPageLoadException(exc2);
            }
            Instrumentation.DnnLog.Error("FriendlyMessage=\"{0}\" ctrl=\"{1}\" exc=\"{2}\"", FriendlyMessage, ctrl, exc);
        }
コード例 #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Version"></param>
        /// <returns></returns>
        /// <remarks>This is not localizing Page Name or description.</remarks>
        public string UpgradeModule(string Version)
        {
            try
            {
                var pageName        = Localization.GetString("HTMLEditorPageName", ResourceFile);
                var pageDescription = Localization.GetString("HTMLEditorPageDescription", ResourceFile);

                switch (Version)
                {
                case "06.00.00":

                    //Create Rad Editor Config Page (or get existing one)
                    TabInfo newPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/radeditor_config_small.png", ModuleFolder + "/images/radeditor_config_large.png", true);

                    //Add Module To Page
                    int moduleDefId = GetModuleDefinitionID();
                    Upgrade.AddModuleToPage(newPage, moduleDefId, pageName, ModuleFolder + "/images/radeditor_config_large.png", true);

                    foreach (var item in DesktopModuleController.GetDesktopModules(Null.NullInteger))
                    {
                        DesktopModuleInfo moduleInfo = item.Value;

                        if (moduleInfo.ModuleName == "DotNetNuke.RadEditorProvider")
                        {
                            moduleInfo.Category = "Host";
                            DesktopModuleController.SaveDesktopModule(moduleInfo, false, false);
                        }
                    }
                    break;

                case "07.00.06":
                    UpdateConfigOfLinksType();
                    break;

                case "07.03.00":
                    UpdateConfigFilesName();
                    UpdateToolsFilesName();
                    break;

                case "07.04.00":
                    // Find the RadEditor page.  It should already exist and this will return it's reference.
                    var editorPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/HtmlEditorManager_Standard_16x16.png", ModuleFolder + "/images/HtmlEditorManager_Standard_32x32.png", true);

                    // If the Html Editor Manager is installed, then remove the old RadEditor Manager
                    var htmlEditorManager = DesktopModuleController.GetDesktopModuleByModuleName("DotNetNuke.HtmlEditorManager", Null.NullInteger);
                    if (htmlEditorManager != null)
                    {
                        Upgrade.RemoveModule("RadEditor Manager", editorPage.TabName, editorPage.ParentId, false);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                ExceptionLogController xlc = new ExceptionLogController();
                xlc.AddLog(ex);

                return("Failed");
            }

            return("Success");
        }
コード例 #19
0
        public static void LogException(ModuleLoadException exc)
        {
            ExceptionLogController objExceptionLog = new ExceptionLogController();

            objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.MODULE_LOAD_EXCEPTION);
        }