为什么在此aspx页中看不到详细的错误消息? [英] Why can't i see a detailed error message in this aspx page?

查看:170
本文介绍了为什么在此aspx页中看不到详细的错误消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 aspx页,它显示了自定义错误,但我看不到详细信息错误信息。
我的web.config看起来像这样,

I have a aspx page and it displays custom error but i can't see a detailed error message. My web.config looks like this,

<?xml version="1.0"?>
    <configuration>
    <appSettings />
    <connectionStrings />
    <system.web>
        <compilation debug="true" />
        <authentication mode="Windows" />
        <customErrors mode="On" />
    </system.web>
</configuration>


推荐答案

要查看错误,您需要 customErrors off ,如下所示:

To see the error you need customErrors off, like this:

<customErrors mode="Off"></customErrors>

从文档开始,以下是 mode 属性的选项:

From the docs, here are the options for the mode attribute:



  • 打开-指定启用自定义错误。如果未指定defaultRedirect属性,则用户将看到一般错误。自定义错误将显示给远程客户端和本地主机。

  • 关闭-指定禁用自定义错误。详细的ASP.NET错误显示给远程客户端和本地主机。

  • RemoteOnly -指定自定义错误仅显示给远程客户端,ASP.NET错误显示给本地主机。这是默认值。

  • On - Specifies that custom errors are enabled. If no defaultRedirect attribute is specified, users see a generic error. The custom errors are shown to the remote clients and to the local host.
  • Off - Specifies that custom errors are disabled. The detailed ASP.NET errors are shown to the remote clients and to the local host.
  • RemoteOnly - Specifies that custom errors are shown only to the remote clients, and that ASP.NET errors are shown to the local host. This is the default value.



警告



在实时制作的网站上设置 Off 风险很大,因为某些错误消息可能会破坏您网站上的敏感数据(例如代码和路径)甚至密码)。

Warning

Setting Off on a live-production site is very risky as some error messages might compromise sensitive data on your site (like code and paths maybe even passwords).

这篇关于为什么在此aspx页中看不到详细的错误消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆