Pergunta

Para que serve esta página? Eu tenho uma entrada no arquivo de configuração ... isso causa algum dano?

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

É o erro abaixo do 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>
Foi útil?

Solução

Os arquivos 'genericerRorPage.htm', 'noaccess.htm' e 'filenotfound.htm' são nomes de arquivos padrão, criados pelo Visual Studio ao criar um aplicativo da web. Você pode usar qualquer arquivo html ou página ASPX e usar esse nome no web.config. Esses nomes são apenas valores fictícios.

Outras dicas

Basicamente, se um usuário receber algum erro que não seja 403 ou 404 (o mais notável que o que é 500 que for enviado se houver uma exceção), eles serão redirecionados para essa página, que não existirá (e se você estiver no iIS7 O pipeline integrado ou o iis6 selvagem mapeados eles serão saltitados para fileNotfound.htm - caso contrário, eles apenas verão um 404 padrão).

Provavelmente seria bom pelo menos dar ao usuário um "Oh não! Algo está errado!" página.

Se ocorrer um erro e o código de status for diferente de 403 ou 404, ele será redirecionado para GenericErrorPage.htm

Além disso, você tem um erro em sua declaração. o mode atributo deve ser Off ao invés de off:

<customErrors mode="Off" defaultRedirect="GenericErrorPage.htm">
    <error statusCode="403" redirect="NoAccess.htm" />
    <error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top