Prev: Communication with the underlying transaction manager has failed
Next: need info about web parts
From: Luc on 3 Mar 2010 08:56 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: firstname.name(a)ourdomain.be . 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.ContentTemplateContainer.FindControl("username"), TextBox) em = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.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.GetType(), "myscript", _ " alert(Unknown user.');", True) End Sub End Class
|
Pages: 1 Prev: Communication with the underlying transaction manager has failed Next: need info about web parts |