Reputation: 1605
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
Upvotes: 0
Views: 312
Reputation: 19220
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 CreateUser
should return a MembershipCreateStatus
as an error code.
MembershipCreateStatus.DuplicateEmail
See here for more error codes.
Upvotes: 1