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?

Reply
Thread Tools

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

 
 
Luc
Guest
Posts: n/a
 
      03-03-2010
Hi,

i use the login control in order to create users. Asp.net generates
automatically a password which is sent to the user by email.
The emailaddress must be like this: http://www.velocityreviews.com/forums/(E-Mail Removed) . I can
easely check whether it terminates with @ourdomain.be, but if
'firstname.name' doesn't exist in our Exchange server ('ourdomain.be'),
then:

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 (vb.net):

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

If Not Right(em.Text, 12) = "ourdomain.be" 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
CreateUserWizard1.SendingMail
Label2.Visible = False
e.Message.Body = e.Message.Body.Replace("##user##",
CreateUserWizard1.UserName)
e.Message.Body = e.Message.Body.Replace("##password##",
CreateUserWizard1.Password)
End Sub
-----------------------------------------------
Protected Sub CreateUserWizard1_SendMailError(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.SendMailErrorEventArgs) Handles
CreateUserWizard1.SendMailError
Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(),
"myscript", _
" alert(Unknown user.');", True)
End Sub
End Class


 
Reply With Quote
 
 
 
Reply

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



Advertisments