这是什么页面? 我在配置文件中有一个条目...这会造成任何伤害吗?

  <customErrors mode="off" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>

是GenericErrorPage.htm

的以下错误
Server Error in '/' Application.
--------------------------------------------------------------------------------

Runtime Error 
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. 

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>
有帮助吗?

解决方案

文件'GenericErrorPage.htm','NoAccess.htm'和'FileNotFound.htm'是默认文件名,由Visual Studio在创建Web应用程序时创建。您可以使用任何HTML文件或aspx页面,并在web.config中使用该名称。这些名称只是虚拟值。

其他提示

基本上,如果用户收到403或404以外的任何错误(除了那些除了500之外的其他错误,如果有例外),它们将被重定向到该页面,这将不存在(如果你'在IIS7集成管道中或者有IIS6通配符映射后,它们将被反弹到FileNotFound.htm - 否则它们只会看到标准的404)。

至少给用户一个“哦不!”可能会很好!出了点问题!“页。

如果发生错误并且状态代码不同于403或404,它将重定向到 GenericErrorPage.htm

您的声明中也有错误。 mode 属性应该是 Off 而不是 off

<customErrors mode="Off" defaultRedirect="GenericErrorPage.htm">
    <error statusCode="403" redirect="NoAccess.htm" />
    <error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top