SmtpClient.SendAsync bug in ASP.NET 2.0

  • Thread starter Thread starter Olivier MATROT
  • Start date Start date
O

Olivier MATROT

Hello,
I may be wrong, but if you are working with SmtpClient.SendAsync in ASP.NET
2.0 and it throws an exception, the thread processing the request waits
indefinitely for the operation to complete.

To reproduce this problem, simply use an invalid SMTP address for the host
that could not be resolved when sending an email.

Note that you should set Page.Async = true to use SendAsync.

If Page.Async is set to false and SendAsync throws an exception the thread
does not block, and the page is processed correctly.

TIA.
 
its a bug in your code. when SmptClient throws an error, it up to your code
to catch it and return a valid IAsyncResult that signals complete.

-- bruce (sqlwork.com)
 
Are you sure ?
Because SmtpClient.SendAsync's APM is Event-Driven based, so there is no
IASyncResult involved in that case.

Olivier.
 
Back
Top