当前位置: 首页>>代码示例>>C#>>正文


C# HttpException.ToString方法代码示例

本文整理汇总了C#中System.Web.HttpException.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# HttpException.ToString方法的具体用法?C# HttpException.ToString怎么用?C# HttpException.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.HttpException的用法示例。


在下文中一共展示了HttpException.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LogException

        public static void LogException(HttpException exception)
        {
            if (exception != null)
            {
                Debug.Print(exception.ToString());
                Logger.Error(exception.ToString());

                try
                {
                    var error = new VLogServerSideError(exception);

                    VLogErrorCode weberrorcode = VLog.GetWebErrorCodeOrDefault(error.ErrorCode, VLogErrorTypes.ServerSideIIS);
                    if (weberrorcode != null && !weberrorcode.ExcludeFromLogging)
                    {
                        if (VLog.OnCommitExceptionToServerRepository != null)
                        {
                            VLog.OnCommitExceptionToServerRepository(error);
                        }
                    }
                }
                catch (Exception ex)
                {
                    // IMPORTANT! We swallow any exception raised during the
                    // logging and send them out to the trace . The idea
                    // here is that logging of exceptions by itself should not
                    // be  critical to the overall operation of the application.
                    // The bad thing is that we catch ANY kind of exception,
                    // even system ones and potentially let them slip by.
                    Logger.Error(ex.ToString());
                    Debug.Print(ex.Message);
                }
            }
        }
开发者ID:MGramolini,项目名称:vodca,代码行数:33,代码来源:VLog.LogException.cs

示例2: Application_Error

		protected void Application_Error()
		{
			// Log ASP.NET errors (404, 500)
			HttpException exception = new HttpException(null, HttpContext.Current.Server.GetLastError());
			Log.Error("An ASP.NET based error occurred - ({0}) - {1}", 
						exception.GetHttpCode(),
						exception.ToString());
		}
开发者ID:35e8,项目名称:roadkill,代码行数:8,代码来源:RoadkillApplication.cs

示例3: ResourceErrorActionResult

 /// <summary>
 /// Sends back a response using the status code in the HttpException.
 /// The response body contains a details serialized in the responseFormat.
 /// If the HttpException.Data has a key named "details", its value is used as the response body.
 /// If there is no such key, HttpException.ToString() is used as the response body.
 /// </summary>
 /// <param name="httpException"></param>
 /// <param name="responseFormat"></param>
 public ResourceErrorActionResult(HttpException httpException, ContentType responseFormat) {
     this.statusCode = (HttpStatusCode)httpException.GetHttpCode();
     this.details = httpException.Data.Contains("details") ? httpException.Data["details"] : httpException.ToString();
     this.responseFormat = responseFormat;
 }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:13,代码来源:ResourceErrorActionResult.cs


注:本文中的System.Web.HttpException.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。