Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Mail script doesn't catch the exception


Message #1 by Philip Steel <PhilipS@t...> on Thu, 25 Jul 2002 16:33:45 +0100
Lynn, David et al,

Many thanks for your help

I ended up using the GetBaseException method of the Exception Class:
this returned the full error:

Try
	SmtpMail.Send(mailMsg)
Catch ex As Exception
	HttpContext.Current.Response.Write(ex.GetBaseException)
End Try

Cheers

phil

-----Original Message-----
From: Curtner, Lynn [mailto:lynn.curtner@p...]
Sent: 25 July 2002 16:47
To: ASPX_Professional
Subject: [aspx_professional] RE: Mail script doesn't catch the exception



Make your Catch block (much) more generic, e.g., Catch exWhatever As
System.Exception..., and examine the actual exception that's being thrown to
see what type it really is.

> ----------
> From: 	Philip Steel[SMTP:PhilipS@t...]
> Reply To: 	ASPX_Professional
> Sent: 	Thursday, July 25, 2002 10:33 AM
> To: 	ASPX_Professional
> Subject: 	[aspx_professional] Mail script doesn't catch the exception
> 
> Hi all
> 
> I was wondering if you could shed some light on this - I am trying to
> errorhandle this script
> as it doesn't like hotmail addresses and for some reason it's not handling
> the exception
> when I look for it:
> 
> <%@ Page Language="VB" %>
> <%@ Import Namespace="System.Web" %>
> <%@ Import Namespace="System.Web.Mail" %>
> <%
> Dim mailMsg As MailMessage = New MailMessage()
> mailMsg.From = "philips@t..."
> mailMsg.To = "phil_steel@h..."
> mailMsg.Subject = "Test"
> mailMsg.Body = "Test"
> SmtpMail.SmtpServer = "JUPITER"
> Try
> 	SmtpMail.Send(mailMsg)
> Catch exCOM As System.Runtime.InteropServices.COMException
> 	Throw New System.Runtime.InteropServices.COMException("No Hotmail
> addresses!")
> End Try
> %>
> Done!
> 
> 
> ...any ideas?
> 
> Phil
> 
> Phil Steel 
> TEQUILA\ Digital 
> 82 Charing Cross Road 
> LONDON WC2H 0QB 
> 020 7557 6228 
> 
> 
> 
> 


  Return to Index