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 );
        }
Example #2
0
        public static void LogToEventLog(string methodName, string message)
        {
            DotNetNuke.Services.Log.EventLog.ExceptionLogController objEventLog = new DotNetNuke.Services.Log.EventLog.ExceptionLogController();
            DotNetNuke.Services.Log.EventLog.LogInfo objEventLogInfo            = new DotNetNuke.Services.Log.EventLog.LogInfo();
            objEventLogInfo.BypassBuffering = true;
            objEventLogInfo.LogTypeKey      = "ADMIN_ALERT";
            objEventLogInfo.LogPortalID     = staticPortalSettings.PortalId;

            LogDetailInfo logInfo1 = new LogDetailInfo("methodName: ", methodName);
            LogDetailInfo logInfo2 = new LogDetailInfo("Message: ", message);

            objEventLogInfo.LogProperties.Add(logInfo1);
            objEventLogInfo.LogProperties.Add(logInfo2);
            objEventLog.AddLog(objEventLogInfo);

            //eventLog.AddLog("DNN.Authentication.SAML." + methodName + " : " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss:fff"), message, staticPortalSettings, -1, EventLogController.EventLogType.ADMIN_ALERT);
        }
Example #3
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", true);

                        // 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;
                }
            }
            catch (Exception ex)
            {
                var xlc = new ExceptionLogController();
                xlc.AddLog(ex);

                return "Failed";
            }

            return "Success";
        }
		/// <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;
				}
			}
			catch (Exception ex)
			{
				ExceptionLogController xlc = new ExceptionLogController();
				xlc.AddLog(ex);

				return "Failed";
			}

			return "Success";
		}
Example #5
0
        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);
            }
        }
Example #6
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";
		}
Example #7
0
		/// <summary>
		/// Processes the scheduler exception.
		/// </summary>
		/// <param name="exc">The exc.</param>
        public static void ProcessSchedulerException(Exception exc)
        {
            Logger.Error(exc);
            var objExceptionLog = new ExceptionLogController();
            objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.SCHEDULER_EXCEPTION);
        }
Example #8
0
		/// <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);
        }
Example #9
0
		/// <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);
        }
Example #10
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);
        }
Example #11
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);
                    }
                }
            }
        }
Example #12
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)
        {
            			//Exit Early if ThreadAbort Exception
            if (ThreadAbortCheck(exc))
            {
                return;
            }
            PortalSettings _portalSettings = PortalController.Instance.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)
            {
                Logger.Fatal(exc2);
                ProcessPageLoadException(exc2);
            }
            Logger.ErrorFormat("FriendlyMessage=\"{0}\" ctrl=\"{1}\" exc=\"{2}\"", FriendlyMessage, ctrl, exc);

        }
Example #13
0
 public static void LogException( ModuleLoadException exc )
 {
     ExceptionLogController objExceptionLog = new ExceptionLogController();
     objExceptionLog.AddLog( exc, ExceptionLogController.ExceptionLogType.MODULE_LOAD_EXCEPTION );
 }
Example #14
0
        public static void ProcessModuleLoadException( string FriendlyMessage, Control UserCtrl, Exception exc )
        {
            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 );
                    //publish the exception
                    ExceptionLogController objExceptionLog = new ExceptionLogController();
                    objExceptionLog.AddLog( lex );
                    //add the error message to the user control
                    UserCtrl.Controls.Add( new ErrorContainer( _portalSettings, FriendlyMessage, lex ).Container );
                }
            }
            catch
            {
                ProcessPageLoadException( exc );
            }
        }
Example #15
0
 public static void LogException( SchedulerException exc )
 {
     ExceptionLogController objExceptionLog = new ExceptionLogController();
     objExceptionLog.AddLog( exc, ExceptionLogController.ExceptionLogType.SCHEDULER_EXCEPTION );
 }
Example #16
0
        public static void ProcessModuleLoadException( string FriendlyMessage, Control 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 );
                    //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 = (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 );
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);
            try
            {
                litFBConnect.Text = "<fb:login-button show-faces=\"true\" perms=\"email\" width=\"250\" max-rows=\"4\"></fb:login-button>";
                this.BackgroundImageUrl = ResolveUrl("~/DesktopModules/ATI_Base/services/images/profile.aspx") + "?u=0&p=0&bg=1";
                litStatus.Text = "";
                if (!Page.IsPostBack && !Page.IsCallback)
                {
                    imgfbConnect.Src = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/fbplatform.gif");
                    if (Request["t"] != null)
                    {
                        RadAjaxManager1.ResponseScripts.Add(" $(function(){ Aqufit.Page.Tabs.SwitchTab(" + Request["t"] + "); }); ");
                    }
                    if (Request["g"] != null)
                    {
                        hiddenGroupKey.Value = Request["g"];
                    }

                    imgError.Src = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/iError.png");
                    imgCheck.Src = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/iCheck.png");
                    if (Settings["Beta"] != null)
                    {
                        this.IsBeta = Convert.ToBoolean(Settings["Beta"]);
                        panelBeta.Visible = this.IsBeta;
                    }
                    ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/RegisterService.asmx");
                    service.InlineScript = true;
                    ScriptManager.GetCurrent(Page).Services.Add(service);
                    if (Settings["Configure"] != null && Convert.ToString(Settings["Configure"]) == "ConfigureLogin")
                    {
                        atiRegistrationPanel.Visible = false;
                        atiLoginPanel.Visible = true;

                        fbConnect.Text = "<fb:login-button show-faces=\"true\" perms=\"email\" width=\"250\" max-rows=\"4\"></fb:login-button>";
                    }
                    else if (Settings["Configure"] != null && Convert.ToString(Settings["Configure"]) == "ConfigureGroupRegister")
                    {
                        if (GroupSettings != null)   // This is a person trying to edit a group profile
                        {
                            UserFriends perm = entities.UserFriends.FirstOrDefault(w => w.SrcUserSettingKey == UserSettings.Id && w.DestUserSettingKey == GroupSettings.Id && w.Relationship <= (int)Affine.Utils.ConstsUtil.Relationships.GROUP_ADMIN);
                            // check that they have permissions first (need to be a group admin)
                            if (perm != null)
                            {
                                SetupAccountEdit(GroupSettings);
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~") + UserSettings.UserName, true);
                            }

                        }
                        else
                        {
                            atiRegistrationPanel.Visible = false;
                            aqufitEntities entities = new aqufitEntities();
                            GroupType[] groupTypes = entities.GroupTypes.ToArray();
                        }
                    }
                    else if (Settings["RpxReciever"] != null && Convert.ToBoolean(Settings["RpxReciever"]))
                    {       // We just use FB login now... so may want to rename this setting in future..
                        if (base.fbUser == null || string.IsNullOrWhiteSpace(base.fbUser.email) || base.fbUser.id <= 0 )
                        {
                            throw new Exception("Problem with FaceBook Login");
                        }
                        atiRegistrationPanel.Visible = false;
                        atiRpxRecievePanel.Visible = true;

                        aqufitEntities entities = new aqufitEntities();
                        if (this.IsBeta)
                        {
                            Preview tester = entities.Preview.FirstOrDefault(p => p.EnteredByPortalId == this.PortalId && string.Compare(p.Email, fbUser.email, true) == 0);
                            if (tester == null)
                            {
                                RadAjaxManager1.ResponseScripts.Add("Aqufit.Windows.ErrorDialog.open('{\"html\":\"Sorry you are not on the Beta Test list.\"}');");
                                return;
                            }
                        }
                        // This is the first time in so we need to register them
                        hiddenEmail.Value = base.fbUser.email;
                        hiddenGivenName.Value = base.fbUser.first_name;
                        hiddenFamilyName.Value = base.fbUser.last_name;
                        hiddenIdentifier.Value = "" + base.fbUser.id;
                        // if we do not get a sex ... we assume male.. otherwise leader boards do not get processed ..
                        hiddenGender.Value = string.IsNullOrWhiteSpace( base.fbUser.gender ) ? "M" : base.fbUser.gender.ToLower().StartsWith("m") ? "M" : "F";
                        hiddenBirthday.Value = "";
                    }
                    else
                    {   // we need to track this and produce an error message
                        if (this.UserId > 0)
                        {
                            SetupAccountEdit(this.UserSettings);
                        }
                    }
                }
                else
                {
                    RadCaptcha1.EnableRefreshImage = true;
                    RadCaptcha1.CaptchaTextBoxLabel = "";
                    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);
                        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);
                        }
                    }

                    // We still need to configure which inputs we want from the module settings.
                    if (Settings["HideGender"] != null && Convert.ToBoolean(Settings["HideGender"]))
                    {
                        atiBodyComp.GenderVisible = false;
                    }
                    if (Settings["HideBirthday"] != null && Convert.ToBoolean(Settings["HideBirthday"]))
                    {
                        atiBodyComp.BirthDateVisible = false;
                    }
                    if (Settings["HideWeight"] != null && Convert.ToBoolean(Settings["HideWeight"]))
                    {
                        atiBodyComp.WeightVisible = false;
                    }
                    if (Settings["HideHeight"] != null && Convert.ToBoolean(Settings["HideHeight"]))
                    {
                        atiBodyComp.HeightVisible = false;
                    }
                    if (Settings["HideFitnessLevel"] != null && Convert.ToBoolean(Settings["HideFitnessLevel"]))
                    {
                        atiBodyComp.FitnessLevelVisible = false;
                    }
                }

            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
		/// <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";
		}
Example #19
0
		/// <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);
        }
        /// <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);
            }
        }
Example #21
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);
     }
 }
Example #22
0
        public static void ProcessPageLoadException( Exception exc, string URL )
        {
            if( ThreadAbortCheck( exc ) )
            {
                return;
            }

            PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();

            if( Convert.ToString( Globals.HostSettings["UseCustomErrorMessages"] ) == "N" )
            {
                throw ( new PageLoadException( exc.Message, exc ) );
            }
            else
            {
                PageLoadException lex = new PageLoadException( exc.Message.ToString(), exc );
                //publish the exception
                ExceptionLogController objExceptionLog = new ExceptionLogController();
                objExceptionLog.AddLog( lex );
                // redirect

                if( !String.IsNullOrEmpty(URL) )
                {
                    if( URL.IndexOf( "error=terminate" ) != -1 )
                    {
                        HttpContext.Current.Response.Clear();
                        HttpContext.Current.Server.Transfer( "~/ErrorPage.aspx" );
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect( URL, true );
                    }
                }
            }
        }