' ' DotNetNukeŽ - http://www.dotnetnuke.com ' Copyright (c) 2002-2008 ' by DotNetNuke Corporation ' ' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated ' documentation files (the "Software"), to deal in the Software without restriction, including without limitation ' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and ' to permit persons to whom the Software is furnished to do so, subject to the following conditions: ' ' The above copyright notice and this permission notice shall be included in all copies or substantial portions ' of the Software. ' ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED ' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ' DEALINGS IN THE SOFTWARE. ' Imports System.IO Imports DotNetNuke.Security Imports DotNetNuke.Services.Localization Namespace DotNetNuke.Services.Exceptions ''' ----------------------------------------------------------------------------- ''' Project : DotNetNuke ''' Class : ErrorPage ''' ''' ----------------------------------------------------------------------------- ''' ''' Trapped errors are redirected to this universal error page, resulting in a ''' graceful display. ''' ''' ''' 'get the last server error ''' 'process this error using the Exception Management Application Block ''' 'add to a placeholder and place on page ''' 'catch direct access - No exception was found...you shouldn't end up here unless you go to this aspx page URL directly ''' ''' ''' [sun1] 1/19/2004 Created ''' ''' ----------------------------------------------------------------------------- Partial Class ErrorPage Inherits System.Web.UI.Page Private Sub ManageError(ByVal status As String) Dim strErrorMessage As String = Request.QueryString("error") Dim strLocalizedMessage As String = Localization.Localization.GetString(status + ".Error", Localization.Localization.GlobalResourceFile) strLocalizedMessage = strLocalizedMessage.Replace("src=""images/403-3.gif""", "src=""" + ResolveUrl("~/images/403-3.gif") + "") ErrorPlaceHolder.Controls.Add(New LiteralControl(String.Format(strLocalizedMessage, strErrorMessage))) End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init Me.StyleSheet.Attributes("href") = ResolveUrl("~/Install/Install.css") End Sub Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim strLocalizedMessage As String = Null.NullString Dim objSecurity As New PortalSecurity Dim status As String = objSecurity.InputFilter(Request.QueryString("status"), PortalSecurity.FilterFlag.NoScripting Or PortalSecurity.FilterFlag.NoMarkup) If Not String.IsNullOrEmpty(status) Then ManageError(status) Else 'get the last server error Dim exc As Exception = Server.GetLastError Try Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings Dim lex As New PageLoadException(exc.Message.ToString, exc) 'process this error using the Exception Management Application Block 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)) End Try End If strLocalizedMessage = Localization.Localization.GetString("Return.Text", Localization.Localization.GlobalResourceFile) hypReturn.Text = " " + strLocalizedMessage End Sub End Class End Namespace