SmtpClient.SendAsync bug in ASP.NET 2.0

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.
 
B

bruce barker

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)
 
O

Olivier MATROT

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

Olivier.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top