I want to show a custom error page when the project is in production (release mode) and show the default error page from asp.net when running the page in (debug mode).
I have three Web.config files in my project.
- Web.config
- Web.Debug.config
- Web.Release.config
This is what I have tried but had no luck.
Web.config
<customErrors mode="On" defaultRedirect="~/Home/Error">
<error statusCode="404" redirect="~/Home/Error" />
</customErrors>
Web.Debug.config
<customErrors mode="Off" xdt:Transform="Replace"></customErrors>
Web.Release.config
<customErrors mode="On" defaultRedirect="~/Home/Error">
<error statusCode="404" redirect="~/Home/Error" />
</customErrors>
Does anyone know how I can do this?
Thanks in advance :)
Edit: After reading around, I'm thinking that this is a known bug but I wasn't able to find a bug fix for this. If anyone knows more about this, please share. Thanks