Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how to prevent creating user and showing ''Mailbox unavailable' in case of wrong emailaddress?

Thread Tools

how to prevent creating user and showing ''Mailbox unavailable' in case of wrong emailaddress?

Posts: n/a

i use the login control in order to create users. generates
automatically a password which is sent to the user by email.
The emailaddress must be like this: Removed) . I can
easely check whether it terminates with, but if
'' doesn't exist in our Exchange server (''),

1) the user is still created
2) the message page with: 'Mailbox unavailable. The server response was:
5.1.1 User unknown' appears

What i want is 1) that the user is not created and 2) that a simple
Alert-box appears instead of the this error page.

I tried a lot of Try / Catch / Endtry but all my attempts fail: the user is
always created and the whole message page appears. I also tried with
CreateUserWizard1_SendMailError sub.1

Here my code (

Protected Sub CreateUserWizard1_CreatingUser(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.LoginCancelEventArgs) Handles
Dim tx, em As TextBox
tx =
CType(CreateUserWizard1.CreateUserStep.ContentTemp lateContainer.FindControl("username"),
em =
CType(CreateUserWizard1.CreateUserStep.ContentTemp lateContainer.FindControl("email"),

If Not Right(em.Text, 12) = "" Then
Label3.Text = "wrong emailaddress"
e.Cancel = True
End If
End Sub
Protected Sub CreateUserWizard1_SendingMail(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.MailMessageEventArgs) Handles
Label2.Visible = False
e.Message.Body = e.Message.Body.Replace("##user##",
e.Message.Body = e.Message.Body.Replace("##password##",
End Sub
Protected Sub CreateUserWizard1_SendMailError(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.SendMailErrorEventArgs) Handles
Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(),
"myscript", _
" alert(Unknown user.');", True)
End Sub
End Class

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Prevent a Task From Showing on the Taskbar ??? Rick Computer Support 5 03-20-2009 10:51 AM
case ... when and arrays (or what was why_ showing us at railsconf europe) J2M Ruby 8 10-11-2006 11:26 PM
How can I prevent SmartTag from showing? amanda ASP .Net Building Controls 1 02-24-2006 03:01 AM
How to prevent a checkbox from showing up in a datagrid with no records? Burak ASP .Net Datagrid Control 1 05-18-2004 06:01 PM