customErrors設定customErrors設定とは?Web.configでcustomErrorsを有効にする事で、例外発生時(コントローラー内でのthrow new Exception、HTTPコード404/403/500等発生)のエラー処理を指定出来る。 customErrors設定例 <configuration>
<system.web>
<customErrors defaultRedirect="~/Error/" mode="RemoteOnly">
<error statusCode="404" redirect="~/Error/NotFound" />
</customErrors>
</system.web>
</configuration>
上の場合、ErrorクラスとNotFoundメソッドを自作する必要がある。 参考http://msdn.microsoft.com/ja-jp/library/h0hfz6fc(v=vs.100).aspx customErrorsより優先されるエラー
customErrorsとhttpErrors |
|