Pregunta

¿Para qué es esta página? Tengo una entrada en el archivo de configuración ... ¿esto causa algún daño?

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

Es el error a continuación de 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>
¿Fue útil?

Solución

Los archivos 'GenericErrorPage.htm', 'NoAccess.htm' y 'FileNotFound.htm' son nombres de archivo predeterminados, creados por Visual Studio al crear una aplicación web. Puede usar cualquier archivo HTML o página aspx y usar ese nombre en web.config. Estos nombres son solo valores ficticios.

Otros consejos

Básicamente, si un usuario recibe un error distinto de 403 o 404 (el más notable, además de los 500, se envía si hay una excepción) será redirigido a esa página, que no existirá (y si Si se encuentra en la infraestructura integrada de IIS7 o se ha mapeado el comodín de IIS6, estos serán devueltos a FileNotFound.htm; de lo contrario, solo verán un estándar 404).

Probablemente sería bueno, al menos, darle al usuario un " ¡Oh no! ¡Algo está mal! & Quot; página.

Si se produce un error y el código de estado es diferente de 403 o 404, se redireccionará a GenericErrorPage.htm

También tienes un error en tu declaración. El atributo mode debe estar Off en lugar de off :

<customErrors mode="Off" defaultRedirect="GenericErrorPage.htm">
    <error statusCode="403" redirect="NoAccess.htm" />
    <error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top