Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3403432
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:15:38+00:00 2026-05-18T05:15:38+00:00

I am trying to fix the behavior of a CreateUserWizard control in ASP.NET 2.0.

  • 0

I am trying to fix the behavior of a CreateUserWizard control in ASP.NET 2.0. With a fairly naive, out-of-the-box implementation, if you enter an email address that does not exist, or there is some other error sending the email, you get a YSOD showing the ugly details of the SMTP error, plus the user account is created anyway. Handling the SendMailError does not seem to help, as it is fired after the user is already created.

Ideally, an email error would cause an “invalid email address” error message (or something to that effect) to be displayed. Seems like this should be pretty easy, but after quite a bit of looking around I haven’t found an answer. Anybody have any solutions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:15:38+00:00Added an answer on May 18, 2026 at 5:15 am

    This is what I do. It’s not perfect, but it helps.

    protected void CreateUserWizard1_SendMailError(object sender, SendMailErrorEventArgs e)
    {
        // e.Exception can be one of the exceptions generated from SmtpClient.Send(MailMessage)
        if (e.Exception is SmtpFailedRecipientException)
        {
            // The message could not be delivered to one or more of the recipients in To, CC, or BCC()()().
            // TODO: Set an error message on the page
            e.Handled = true;
    
            // Since the user has already been created at this point, we need to remove them.
            Membership.DeleteUser(CreateUserWizard1.UserName);
    
            // Set an internal flag for use in the ActiveStepChanged event.
            emailFailed = true;
    
            return;
        }
    }
    
    protected void CreateUserWizard1_ActiveStepChanged(object sender, EventArgs e)
    {
        if (CreateUserWizard1.ActiveStep != CreateUserWizard1.CompleteStep)
            return;
    
        if (emailFailed)
        {
            // If the email failed, keep the user on the first step.
            CreateUserWizard1.ActiveStepIndex = 0;
            return;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some strange behavior occurring in an ASP.NET application that I am trying
I've been trying to exclude an asp.net web control from the tabbing order. The
I am trying to fix a bug on an ActiveX control. Is it possible
I'm trying to fix a bug at work where in classic ASP a HTML
I'm trying to fix some JavaScript bugs. Firebug makes debugging these issues a lot
I am trying to fix memory leaks in IE 7. Using Drip for investigations
I've been trying to fix this for two hours straight and I can't figure
Hi I'm trying to fix a bit of test html to work with opera/chrome.
I am trying to fix a bug with SSL in a product and noticed
i am trying to fix a site I am helping a friend with, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.