GenericErrorPage.htm失踪

GenericErrorPage.htm失踪

问题描述:

这个页面有用吗? 我在配置文件中有一个条目...这是否会造成任何危害?GenericErrorPage.htm失踪

<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不同它会重定向到GenericErrorPage.htm

你也有一个错误在你的声明中。该mode属性应该是Off而不是off

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

我没有任何文件夹中的GenericErrorPage.htm ..错误我目前看到..i更新..在上述问题。 – SmartestVEGA 2009-11-27 12:30:29

基本上如果用户得到比403或404(比最显着另一种是500,它如果有异常被送到),他们会被重定向以外的任何错误到那个不存在的页面(如果你在IIS7集成管道中,或者映射了IIS6通配符,它​​们会被反弹到FileNotFound.htm - 否则它们只会看到一个标准的404)。

它可能很好,至少给用户一个“哦,不!有什么不对!”页。

+0

以上是GenericErrorPage.htm的错误吗? – SmartestVEGA 2009-11-27 12:32:12

+1

不,那个错误是.NET的自定义错误页面,如果你没有特别指定。要获得更详细的错误,请将的整个customerrors部分换掉(注意:区分大小写),那么您应该获得要处理的错误的详细堆栈跟踪。 – fyjham 2009-11-27 13:25:41