Is there a good way to exclude some errors from being redirected to the default custom error page?
I’m using aspnet membership provider and have just discovered that if for example a user tries to change their email address to one that is already in the system, rather than show the error message warning in the style of a validation error as was designed, since I turned on custom errors, it just redirects to the standard error page.
Do I need to specifically exclude error codes for this problem?
Here is the custom error section in the web config:
<customErrors mode="On" defaultRedirect="/Error/Error500" />
Thanks very much
You need to stop the exception bubbling up in this case, and implement some validation to check if the email address exists.
Your call to
CreateUsershould return aMembershipCreateStatusas an error code.See here for more error codes.