我应该如何处理那些我无法在后面的C#代码中捕获的异常...例如我面临发送邮件system.Net.Sockets.SocketException
的失败但我没有机会处理页面代码隐藏..其中我应该处理吗?
protected void CreateUserWizard1_SendingMail1(object sender, MailMessageEventArgs e)
{
string emailname="";
try
{
TextBox textboxemail = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Email");
MembershipUser user = Membership.GetUser(textboxemail.Text);
Guid userid = (Guid)user.ProviderUserKey;
string verificationurl = "http://www.spiralsnet.com/Login.aspx?NewUserId=" + userid.ToString();
e.Message.IsBodyHtml = true;
e.Message.From = new System.Net.Mail.MailAddress("SpiralsWhirls@yahoo.com", "SpiralsNet");
e.Message.Body = e.Message.Body.Replace("<%VU%>", verificationurl);
}
catch (System.Net.Sockets.SocketException ex)
{
Membership.DeleteUser(emailname);
}
}