Question About Application_Start in Global.asax and async functions

Discussion in 'ASP .Net' started by Bob Johnson, Nov 13, 2003.

  1. Bob Johnson

    Bob Johnson Guest

    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
     
    Bob Johnson, Nov 13, 2003
    #1
    1. Advertising

  2. Bob Johnson

    George Durzi Guest

    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();
    }
    "Bob Johnson" <> wrote in message
    news:...
    > 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
    >
    >
     
    George Durzi, Nov 13, 2003
    #2
    1. Advertising

  3. Bob Johnson

    George Durzi Guest

    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.


    "George Durzi" <> wrote in message
    news:...
    > 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();
    > }
    > "Bob Johnson" <> wrote in message
    > news:...
    > > 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
    > >
    > >

    >
    >
     
    George Durzi, Nov 13, 2003
    #3
  4. Bob Johnson

    Bob Johnson Guest

    So the threading works exactly the same way as it does in windows forms?

    "George Durzi" <> wrote in message
    news:...
    > 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();
    > }
    > "Bob Johnson" <> wrote in message
    > news:...
    > > 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
    > >
    > >

    >
    >
     
    Bob Johnson, Nov 13, 2003
    #4
  5. Bob Johnson

    George Durzi Guest

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

    "Bob Johnson" <> wrote in message
    news:#...
    > So the threading works exactly the same way as it does in windows forms?
    >
    > "George Durzi" <> wrote in message
    > news:...
    > > 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();
    > > }
    > > "Bob Johnson" <> wrote in message
    > > news:...
    > > > 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
    > > >
    > > >

    > >
    > >

    >
    >
     
    George Durzi, Nov 13, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeanne Louw
    Replies:
    2
    Views:
    6,399
    Alvin Bruney
    Jan 13, 2004
  2. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

    =?Utf-8?B?YmNoYXJsZXM=?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    922
    =?Utf-8?B?YmNoYXJsZXM=?=
    Oct 5, 2004
  3. Marc Missire
    Replies:
    3
    Views:
    3,836
    Marc Missire
    Jul 25, 2005
  4. Mark Rae

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,216
    Mark Rae
    May 23, 2006
  5. Aamir Mahmood
    Replies:
    1
    Views:
    1,517
    Peter Bromberg [C# MVP]
    May 28, 2008
Loading...

Share This Page