Forum


HomeHomePremiumPremiumDevelopmentDevelopmentAsync Calls in ModuleAsync Calls in Module
Previous
 
Next
New Post
5/13/2014 8:28 AM
 

I am experimenting around how to handle an issue with a slow SMTP server.  I tried to use the .SendAsync() method of the SmtpClient.  When I did this I ran into an error that upon researching can be solved by adding Async="True" to the <%@Page ..... %>.

The problem I have is that I am working in modules, controls, and ascx files that don't have the <%@ Page %> so I put it in the Default.aspx file of the DNN project.  This works and allowed me to use the asynchronous function call.  Although it worked, this doesn't seem right because I went into the DNN core and made a change that will be overwritten if I update DNN.  I haven't seen any yet, but I am also worried about side effects on other parts of the site with this change.  Does anyone know if I should expect problems?

I think I'm going about this wrong.  Is there a better way to use the .SendAsync() method in modules?

 
New Post
5/13/2014 2:41 PM
 

Andy,

I don't have much experience with the Page Async directive, but another way to do async tasks is to use the System.Threading.Tasks in .NET 4+

IE:

var taskEmail = System.Threading.Tasks.Task.Factory.StartNew(() =>
{
    DotNetNuke.Services.Mail.Mail.SendEmail(msg.From, msg.From, msg.To, msg.Subject, msg.Body, msg.Attachments);
})

 
Previous
 
Next
HomeHomePremiumPremiumDevelopmentDevelopmentAsync Calls in ModuleAsync Calls in Module



Try FREE
30 days money back guaranteed