【问题标题】:Simulating RemoteOnly custom errors using Application_Error ASP.NET使用 Application_Error ASP.NET 模拟 RemoteOnly 自定义错误
【发布时间】:2010-12-19 09:48:18
【问题描述】:

我使用 global.asax 中的 Application_Error 处理我的错误。

如何检查请求是否来自本地客户端以显示有关错误的更多信息或仅显示黄色错误页面。在使用 web.config 处理错误时,ASP 会执行类似“remoteOnly”的操作。

【问题讨论】:

    标签: asp.net error-handling


    【解决方案1】:

    在我发布问题后,我回到我的应用程序并玩了一点,然后我发现了这个。现在我正在使用它。

        void Application_Error(object sender, EventArgs e)
        {
    
            if(!HttpContext.Current.Request.IsLocal) 
                HttpContext.Current.Server.ClearError();
    
            // process error handling
        }
    

    【讨论】:

      猜你喜欢
      • 2010-11-13
      • 2021-02-25
      • 2013-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-10
      相关资源
      最近更新 更多