質問

このページの目的は何ですか? 構成ファイルにエントリがあります...これにより問題が発生しますか?

  <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」はデフォルトのファイル名で、Webアプリケーションの作成時にVisual Studioによって作成されます。任意のHTMLファイルまたはaspxページを使用し、web.configでその名前を使用できます。これらの名前は単なるダミー値です。

他のヒント

基本的に、ユーザーが403または404以外のエラー(例外がある場合に送信される500以外のエラー)を受け取った場合、それらは存在しないページにリダイレクトされます(そして、 IIS7統合パイプラインで再作成するか、IIS6ワイルドカードをマップすると、FileNotFound.htmにバウンスされます。それ以外の場合は、標準の404が表示されます。

少なくともユーザーに&quot;ああ、いいえ!何かおかしい!&quot;ページ。

エラーが発生し、ステータスコードが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