示例#1
0
        public static void ThrowException(BaseWebException e)
        {
            if (e != null)
            {
                context = HttpContext.Current;

                context.Server.ClearError();

                string logMessage = string.Format("<Error>\n\t<CustomMessage>{0}</CustomMessage>\n\t<SystemMessage>{1}</SystemMessage>\n\t<Source>{2}</Source>\n\t<StackTrace>{3}</StackTrace>", e.LogMessage, e.Message, e.Source, e.StackTrace);
                Platform.Log(LogLevel.Error, logMessage);

                context.Items.Add(ImageServerConstants.ContextKeys.StackTrace, logMessage);

                if (e.ErrorMessage != null && !e.ErrorMessage.Equals(string.Empty))
                {
                    context.Items.Add(ImageServerConstants.ContextKeys.ErrorMessage, e.ErrorMessage);
                }
                if (e.ErrorDescription != null && !e.ErrorDescription.Equals(string.Empty))
                {
                    context.Items.Add(ImageServerConstants.ContextKeys.ErrorDescription, e.ErrorDescription);
                }

                context.Server.Transfer(ImageServerConstants.PageURLs.ErrorPage);
            }
        }
示例#2
0
    	public static void ThrowException(BaseWebException e)
        {
            if (e != null)
            {                
                context = HttpContext.Current;

                context.Server.ClearError();

                string logMessage = string.Format("<Error>\n\t<CustomMessage>{0}</CustomMessage>\n\t<SystemMessage>{1}</SystemMessage>\n\t<Source>{2}</Source>\n\t<StackTrace>{3}</StackTrace>", e.LogMessage, e.Message, e.Source, e.StackTrace);
                Platform.Log(LogLevel.Error, logMessage);
                
                context.Items.Add(ImageServerConstants.ContextKeys.StackTrace, logMessage);

                if(e.ErrorMessage != null && !e.ErrorMessage.Equals(string.Empty))
                    context.Items.Add(ImageServerConstants.ContextKeys.ErrorMessage, e.ErrorMessage);
                if (e.ErrorDescription != null && !e.ErrorDescription.Equals(string.Empty))
                    context.Items.Add(ImageServerConstants.ContextKeys.ErrorDescription, e.ErrorDescription);
                
                context.Server.Transfer(ImageServerConstants.PageURLs.ErrorPage);   
            }
        }