How: Sending responses during processing time

  • Thread starter Thread starter Luiz Vianna
  • Start date Start date
L

Luiz Vianna

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
 
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>


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,

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
 
Back
Top