/// <summary> /// Logs the PageLoadException. /// </summary> /// <param name="exc">The exc.</param> public static void LogException(PageLoadException exc) { Instrumentation.DnnLog.Error(exc); var objExceptionLog = new ExceptionLogController(); objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.PAGE_LOAD_EXCEPTION); }
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); } } } }
/// <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) { Instrumentation.DnnLog.Error(URL, exc); if (ThreadAbortCheck(exc)) { return; } PortalSettings _portalSettings = PortalController.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); } } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); PortalSettings portalSettings = PortalController.GetCurrentPortalSettings(); if (portalSettings != null && !String.IsNullOrEmpty(portalSettings.LogoFile)) { IFileInfo fileInfo = FileManager.Instance.GetFile(portalSettings.PortalId, portalSettings.LogoFile); if (fileInfo != null) { headerImage.ImageUrl = FileManager.Instance.GetUrl(fileInfo); } } headerImage.Visible = !string.IsNullOrEmpty(headerImage.ImageUrl); string localizedMessage; var security = new PortalSecurity(); string status = security.InputFilter(Request.QueryString["status"], PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoMarkup); if (!string.IsNullOrEmpty(status)) { ManageError(status); } else { //get the last server error var exc = Server.GetLastError(); try { if (Request.Url.LocalPath.ToLower().EndsWith("installwizard.aspx")) { ErrorPlaceHolder.Controls.Add(new LiteralControl(HttpUtility.HtmlEncode(exc.ToString()))); } else { var lex = new PageLoadException(exc.Message, exc); Exceptions.LogException(lex); localizedMessage = Localization.Localization.GetString("Error.Text", Localization.Localization.GlobalResourceFile); ErrorPlaceHolder.Controls.Add(new ErrorContainer(portalSettings, localizedMessage, lex).Container); } } catch { //No exception was found...you shouldn't end up here //unless you go to this aspx page URL directly localizedMessage = Localization.Localization.GetString("UnhandledError.Text", Localization.Localization.GlobalResourceFile); ErrorPlaceHolder.Controls.Add(new LiteralControl(localizedMessage)); } Response.StatusCode = 500; } localizedMessage = Localization.Localization.GetString("Return.Text", Localization.Localization.GlobalResourceFile); hypReturn.Text = string.Format("<img src=\"{0}/images/lt.gif\" border=\"0\" /> {1}", Globals.ApplicationPath, localizedMessage); }
protected void Page_Load( Object sender, EventArgs e ) { //get the last server error Exception exc = Server.GetLastError(); try { PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings(); PageLoadException lex = new PageLoadException( exc.Message.ToString(), exc ); //process this error using the Exception Management Application Block Exceptions.LogException( lex ); //add to a placeholder and place on page ErrorPlaceHolder.Controls.Add( new ErrorContainer( _portalSettings, "An error has occurred.", lex ).Container ); } catch { //No exception was found...you shouldn't end up here // unless you go to this aspx page URL directly ErrorPlaceHolder.Controls.Add( new LiteralControl( "An unhandled error has occurred." ) ); } }
protected void Page_Load(Object sender, EventArgs e) { //get the last server error Exception exc = Server.GetLastError(); try { PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings(); PageLoadException lex = new PageLoadException(exc.Message.ToString(), exc); //process this error using the Exception Management Application Block Exceptions.LogException(lex); //add to a placeholder and place on page ErrorPlaceHolder.Controls.Add(new ErrorContainer(_portalSettings, "An error has occurred.", lex).Container); } catch { //No exception was found...you shouldn't end up here // unless you go to this aspx page URL directly ErrorPlaceHolder.Controls.Add(new LiteralControl("An unhandled error has occurred.")); } }
private static Skin LoadSkin(PageBase page, string skinPath) { Skin ctlSkin = null; try { string skinSrc = skinPath; if (skinPath.ToLower().IndexOf(Globals.ApplicationPath, StringComparison.Ordinal) != -1) { skinPath = skinPath.Remove(0, Globals.ApplicationPath.Length); } ctlSkin = ControlUtilities.LoadControl<Skin>(page, skinPath); ctlSkin.SkinSrc = skinSrc; //call databind so that any server logic in the skin is executed ctlSkin.DataBind(); } catch (Exception exc) { //could not load user control var lex = new PageLoadException("Unhandled error loading page.", exc); if (TabPermissionController.CanAdminPage()) { //only display the error to administrators var skinError = (Label)page.FindControl("SkinError"); skinError.Text = string.Format(Localization.GetString("SkinLoadError", Localization.GlobalResourceFile), skinPath, page.Server.HtmlEncode(exc.Message)); skinError.Visible = true; } Exceptions.LogException(lex); } return ctlSkin; }
/// <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); }
/// <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); } } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); PortalSettings portalSettings = PortalController.GetCurrentPortalSettings(); if (portalSettings != null && !String.IsNullOrEmpty(portalSettings.LogoFile)) { IFileInfo fileInfo = FileManager.Instance.GetFile(portalSettings.PortalId, portalSettings.LogoFile); if (fileInfo != null) { headerImage.ImageUrl = FileManager.Instance.GetUrl(fileInfo); } } headerImage.Visible = !string.IsNullOrEmpty(headerImage.ImageUrl); string strLocalizedMessage = Null.NullString; PortalSecurity objSecurity = new PortalSecurity(); string status = objSecurity.InputFilter(Request.QueryString["status"], PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoMarkup); if (!string.IsNullOrEmpty(status)) ManageError(status); else { //get the last server error Exception exc = Server.GetLastError(); try { if (Request.Url.LocalPath.ToLower().EndsWith("installwizard.aspx")) ErrorPlaceHolder.Controls.Add(new LiteralControl(HttpUtility.HtmlEncode(exc.ToString()))); else { PageLoadException lex = new PageLoadException(exc.Message, exc); //process this error using the Exception Management Application Block Exceptions.LogException(lex); //add to a placeholder and place on page strLocalizedMessage = Localization.Localization.GetString("Error.Text", Localization.Localization. GlobalResourceFile); ErrorPlaceHolder.Controls.Add( new ErrorContainer(portalSettings, strLocalizedMessage, lex).Container); } } catch { //No exception was found...you shouldn't end up here //unless you go to this aspx page URL directly strLocalizedMessage = Localization.Localization.GetString("UnhandledError.Text", Localization.Localization. GlobalResourceFile); ErrorPlaceHolder.Controls.Add(new LiteralControl(strLocalizedMessage)); } } strLocalizedMessage = Localization.Localization.GetString("Return.Text", Localization.Localization.GlobalResourceFile); hypReturn.Text = "<img src=\"" + Globals.ApplicationPath + "/images/lt.gif\" border=\"0\" /> " + strLocalizedMessage; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); PortalSettings portalSettings = PortalController.GetCurrentPortalSettings(); if (portalSettings != null && !String.IsNullOrEmpty(portalSettings.LogoFile)) { IFileInfo fileInfo = FileManager.Instance.GetFile(portalSettings.PortalId, portalSettings.LogoFile); if (fileInfo != null) { headerImage.ImageUrl = FileManager.Instance.GetUrl(fileInfo); } } headerImage.Visible = !string.IsNullOrEmpty(headerImage.ImageUrl); string localizedMessage; var security = new PortalSecurity(); string status = security.InputFilter(Request.QueryString["status"], PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoMarkup); if (!string.IsNullOrEmpty(status)) ManageError(status); else { //get the last server error var exc = Server.GetLastError(); try { if (Request.Url.LocalPath.ToLower().EndsWith("installwizard.aspx")) { ErrorPlaceHolder.Controls.Add(new LiteralControl(HttpUtility.HtmlEncode(exc.ToString()))); } else { var lex = new PageLoadException(exc.Message, exc); Exceptions.LogException(lex); localizedMessage = Localization.Localization.GetString("Error.Text", Localization.Localization.GlobalResourceFile); ErrorPlaceHolder.Controls.Add(new ErrorContainer(portalSettings, localizedMessage, lex).Container); } } catch { //No exception was found...you shouldn't end up here //unless you go to this aspx page URL directly localizedMessage = Localization.Localization.GetString("UnhandledError.Text", Localization.Localization.GlobalResourceFile); ErrorPlaceHolder.Controls.Add(new LiteralControl(localizedMessage)); } Response.StatusCode = 500; } localizedMessage = Localization.Localization.GetString("Return.Text", Localization.Localization.GlobalResourceFile); hypReturn.Text = localizedMessage; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); PortalSettings portalSettings = PortalController.GetCurrentPortalSettings(); if (portalSettings != null && !String.IsNullOrEmpty(portalSettings.LogoFile)) { var fileInfo = FileManager.Instance.GetFile(portalSettings.PortalId, portalSettings.LogoFile); headerImage.ImageUrl = FileManager.Instance.GetUrl(fileInfo); } else { headerImage.Visible = false; } string strLocalizedMessage = Null.NullString; var objSecurity = new PortalSecurity(); string status = objSecurity.InputFilter(Request.QueryString["status"], PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoMarkup); if (!string.IsNullOrEmpty(status)) { ManageError(status); } else { //get the last server error Exception exc = Server.GetLastError(); try { if (Request.Url.LocalPath.ToLower().EndsWith("installwizard.aspx")) { ErrorPlaceHolder.Controls.Add(new LiteralControl(HttpUtility.HtmlEncode(exc.ToString()))); } else { var lex = new PageLoadException(exc.Message, exc); //process this error using the Exception Management Application Block Exceptions.LogException(lex); //add to a placeholder and place on page strLocalizedMessage = Localization.Localization.GetString("Error.Text", Localization.Localization. GlobalResourceFile); ErrorPlaceHolder.Controls.Add( new ErrorContainer(portalSettings, strLocalizedMessage, lex).Container); } } catch { //No exception was found...you shouldn't end up here //unless you go to this aspx page URL directly strLocalizedMessage = Localization.Localization.GetString("UnhandledError.Text", Localization.Localization. GlobalResourceFile); ErrorPlaceHolder.Controls.Add(new LiteralControl(strLocalizedMessage)); } } strLocalizedMessage = Localization.Localization.GetString("Return.Text", Localization.Localization.GlobalResourceFile); hypReturn.Text = "<img src=\"" + Globals.ApplicationPath + "/images/lt.gif\" border=\"0\" /> " + strLocalizedMessage; }
public static void LogException(PageLoadException exc) { ExceptionLogController objExceptionLog = new ExceptionLogController(); objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.PAGE_LOAD_EXCEPTION); }
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 ); } } } }
private UserControl LoadSkin( string SkinPath ) { UserControl ctlSkin = null; try { if( SkinPath.ToLower().IndexOf( Globals.ApplicationPath.ToLower() ) != - 1 ) { SkinPath = SkinPath.Remove( 0, Globals.ApplicationPath.Length ); } ctlSkin = (UserControl)LoadControl( "~" + SkinPath ); // call databind so that any server logic in the skin is executed ctlSkin.DataBind(); } catch( Exception exc ) { // could not load user control PageLoadException lex = new PageLoadException( "Unhandled error loading page.", exc ); if( PortalSecurity.IsInRoles( PortalSettings.AdministratorRoleName ) || PortalSecurity.IsInRoles( PortalSettings.ActiveTab.AdministratorRoles.ToString() ) ) { // only display the error to administrators SkinError.Text += "<div style=\"text-align:center\">Could Not Load Skin: " + SkinPath + " Error: " + Server.HtmlEncode(exc.Message) + "</div><br>"; SkinError.Visible = true; } Exceptions.LogException( lex ); } // check for and read skin package level doctype SetSkinDoctype( SkinPath ); return ctlSkin; }