Can `customErrors mode="Off"` be configured at a granular level, for example, for a specific subdirectory or a particular type of error?

Question

Grade: Education Subject: Support
Can `customErrors mode="Off"` be configured at a granular level, for example, for a specific subdirectory or a particular type of error?
Asked by:
136 Viewed 136 Answers

Answer (136)

Best Answer
(587)
The `customErrors` setting itself applies broadly to the application or subdirectory where the `web.config` is located. While you can place a `web.config` with `customErrors mode="Off"` in a subdirectory to override parent settings for that specific path, you cannot use `customErrors mode="Off"` to conditionally show detailed errors only for a particular type of error (e.g., only for `SqlException`). If `mode="Off"`, all unhandled errors will show details. For specific error types, you would typically use `` with `mode="On"` or `RemoteOnly`.