How: Sending responses during processing time

Discussion in 'ASP .Net' started by Luiz Vianna, Nov 13, 2003.

  1. Luiz Vianna

    Luiz Vianna Guest

    Hi folks,

    I got a problem that certainly someone had too.

    After a user request, I (my server) must process a lot of data that will expend some time. During this process I must inform the user the status of the overall process.

    What I'm facing is that my ASPX/vb file that does this long task is completely processed before some response could be given to the user.

    Result: After filling the form, the user clicks the button and the form remains on the screen while processing time and the user is not sure that the process is running or even if it was fired.

    I've tried some ideas like
    - using response.write/response.flush
    - Using server.transfer/server.execute

    but they didn't work. Someone have some good idea????

    Thanks in advance

    Luiz
    Luiz Vianna, Nov 13, 2003
    #1
    1. Advertising

  2. Re: Sending responses during processing time

    Gee - in a desktop application, you would probably use threading, but you
    really can't safely do asynchronous programming in web applications, in my
    opinion.

    I think if I were you, I would look at the architecture, rather than the
    cosmetics of a long operation. What can you do so that the user isn't held
    up on the page? What if you encapsulate the processing functionality in a
    component that can be triggered via an MSMQ message? Then you don't need to
    keep the user waiting, and the long processing work is put behind the scenes
    to process in its own due course (really this is asynchronous programming,
    just without threading.)

    If the long operation results in data displayed to the screen, one trick you
    can do is to put the processing function in a second page. Put the call to
    the processing functionality somewhere in the rendered html, so that the
    processing only starts after something displays to the user indicating work
    in process.

    Something like this.

    <%# Page Language=C# %>
    <script runat=server>
    private void DoSomeBigThing()
    {
    //lots of hard stuff
    }

    </script>
    <html>
    <head/>
    <body>
    <p>Working...</p>
    <% DoSomeBigThing(); %>
    <p> etc....</p>
    </body>
    </html>


    "Luiz Vianna" <> wrote in message
    news:uxvz8$...
    Hi folks,

    I got a problem that certainly someone had too.

    After a user request, I (my server) must process a lot of data that will
    expend some time. During this process I must inform the user the status of
    the overall process.

    What I'm facing is that my ASPX/vb file that does this long task is
    completely processed before some response could be given to the user.

    Result: After filling the form, the user clicks the button and the form
    remains on the screen while processing time and the user is not sure that
    the process is running or even if it was fired.

    I've tried some ideas like
    - using response.write/response.flush
    - Using server.transfer/server.execute

    but they didn't work. Someone have some good idea????

    Thanks in advance

    Luiz
    Richard K Bethell, Nov 13, 2003
    #2
    1. Advertising

  3. Luiz Vianna

    Luiz Vianna Guest

    Re: Sending responses during processing time

    Richard,

    thanks for Your time....

    I studied the case of rearrange the code to turn things faster, but the most part of this processing time is preparing individual and personalized messages to send by IIS SMTP to all customers.

    On ASP I used to write (response.write) a dot (".") for each mail sent and it was fine...

    Your Idea of putting the code using <script runat=server> is nice because turns the thing closer to ASP processing, I will try that.

    Maybe I should figure out how to prepare this e-mails on other way.

    Thanks again

    Luiz




    "Richard K Bethell" <> escreveu na mensagem news:...
    > Gee - in a desktop application, you would probably use threading, but you
    > really can't safely do asynchronous programming in web applications, in my
    > opinion.
    >
    > I think if I were you, I would look at the architecture, rather than the
    > cosmetics of a long operation. What can you do so that the user isn't held
    > up on the page? What if you encapsulate the processing functionality in a
    > component that can be triggered via an MSMQ message? Then you don't need to
    > keep the user waiting, and the long processing work is put behind the scenes
    > to process in its own due course (really this is asynchronous programming,
    > just without threading.)
    >
    > If the long operation results in data displayed to the screen, one trick you
    > can do is to put the processing function in a second page. Put the call to
    > the processing functionality somewhere in the rendered html, so that the
    > processing only starts after something displays to the user indicating work
    > in process.
    >
    > Something like this.
    >
    > <%# Page Language=C# %>
    > <script runat=server>
    > private void DoSomeBigThing()
    > {
    > //lots of hard stuff
    > }
    >
    > </script>
    > <html>
    > <head/>
    > <body>
    > <p>Working...</p>
    > <% DoSomeBigThing(); %>
    > <p> etc....</p>
    > </body>
    > </html>
    >
    >
    > "Luiz Vianna" <> wrote in message
    > news:uxvz8$...
    > Hi folks,
    >
    > I got a problem that certainly someone had too.
    >
    > After a user request, I (my server) must process a lot of data that will
    > expend some time. During this process I must inform the user the status of
    > the overall process.
    >
    > What I'm facing is that my ASPX/vb file that does this long task is
    > completely processed before some response could be given to the user.
    >
    > Result: After filling the form, the user clicks the button and the form
    > remains on the screen while processing time and the user is not sure that
    > the process is running or even if it was fired.
    >
    > I've tried some ideas like
    > - using response.write/response.flush
    > - Using server.transfer/server.execute
    >
    > but they didn't work. Someone have some good idea????
    >
    > Thanks in advance
    >
    > Luiz
    >
    >
    Luiz Vianna, Nov 13, 2003
    #3
    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. =?Utf-8?B?RmF0Ym95Q2FudGVlbg==?=

    Display Processing Message during long time process

    =?Utf-8?B?RmF0Ym95Q2FudGVlbg==?=, Feb 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    637
    =?Utf-8?B?RmF0Ym95Q2FudGVlbg==?=
    Feb 6, 2004
  2. Cathie Hagen

    Processing image during page load

    Cathie Hagen, Sep 9, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    933
    Sunwest Technologies
    Sep 9, 2004
  3. flamesrock
    Replies:
    8
    Views:
    440
    Hendrik van Rooyen
    Nov 24, 2006
  4. traveller
    Replies:
    0
    Views:
    1,179
    traveller
    Jan 8, 2008
  5. Dmitry Korolyov

    Datagrid not updated during delete, but updated during insert and update

    Dmitry Korolyov, Sep 22, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    403
    Dmitry Korolyov
    Sep 22, 2003
Loading...

Share This Page