I would suggest using the following property:
HttpContext.Current.IsCustomErrorEnabled
As mentioned [here][1], IsCustomErrorEnabled takes more things like RemoteOnly into consideration:
> The IsCustomErrorEnabled property combines three values to tell you
> whether custom errors are enabled for a particular request. This isn't
> as simple as reading the web.config file to check the <customErrors>
> section. There's a bit more going on behind the scenes to truly
> determine whether custom errors are enabled.
>
> The property looks at these three values:
>
> 1. The web.config's < deployment > section's retail property. This is a
> useful property to set when deploying your application to a production
> server. This overrides any other settings for custom errors.
>
> 2. The web.config's < customErrors > section's mode property. This setting
> indicates whether custom errors are enabled at all, and if so whether
> they are enabled only for remote requests.
>
> 3. The HttpRequest object's IsLocal property. If custom errors are enabled only for remote
> requests, you need to know whether the request is from a remote
> computer.
[1]:
[To see links please register here]