Question About Application_Start in Global.asax and async functions

B

Bob Johnson

Hello people.

Short background -- I am constructing a web site that will have several
display tabs that are hooked up to different datatables in a SQL server.
Some of these tables are VERY large -- several million+ records. The tables
have records that are timestamped over several years and
months/quarter/weeks... depending on the individual table they can have
anywhere between 30 and 300 geography/time combinations.

What I would like to do in Application_Start is to create several metadata
objects (datasets) that control what the drop down choices are for the user
to select on each of the main data pages. The problem is sometimes filling
these datatables takes 30-40 seconds+.

So: how do I create something in application_start that fires off a
function that creates and populates my application level objects in a "fire
& forget " method. I can do threading and async calls all day long in win32
forms programming -- this is the first time though I've needed it in ASP.net

Thnx

Bob J
 
G

George Durzi

Here are some resources on Threading in ASP.NET using System.Threading

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemthreading.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconthreadpooling.asp

Here's a quick example. In this example, I'm writing to my db, and at the
same time, wanna email the user. So here's what I do:

In my button click event
{
ForkThreadSendInviteEmails();
Response.Redirect("default.aspx", true);
}

private void ForkThreadSendInviteEmails()
{
Thread thEmailInvoice = new Thread(new ThreadStart(SendInviteEmails));
thEmailInvoice.Priority = ThreadPriority.AboveNormal;
thEmailInvoice.Start();
}
 
G

George Durzi

sorry, I hit Sendtoo soon.

In my ForkThreadSendInviteEmails function, you see the line:
Thread thEmailInvoice = new Thread(new ThreadStart(SendInviteEmails));

You would also have to implement the SendInviteEmails function.
 
G

George Durzi

I have no experience with Windows Forms, but they're both using
System.Threading.
 

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

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top