I have an ASP.NET page which sends an email to a list of of users - this list can be fairly large, and we find the ASP.NET page will often timeout.
What we want to do is send these emails in a new thread, so the ASP.NET page refreshes to the user while the email process is working in the background.
I'm having a bit of a hard time getting my head around what I need to do though. Here's the button click event on my ASP.NET page currently:
protected void btnSend_Click(object sender, EventArgs e)
{
//Populate form data session
_FormInfo = new Dictionary<string, string>();
_FormInfo.Add("Name", txtName.Text);
_FormInfo.Add("Postcode", txtPostcodeDone.Text);
PostcodeSearcher.PostcodeEmailer(_Companies, _FormInfo);
mv.ActiveViewIndex = 3;
}
And here's the method I want to call (inside the PostcodeSearcher class)
public static void PostcodeEmailer(List<Company> companies, Dictionary<string, string> quote)
{
...
}
As you can see the method I need to call in a new thread needs to accept parameters - all I can find online is for calling a new thread without parameters. Any ideas?