472,138 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,138 software developers and data experts.

How: Sending responses during processing time

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

Nov 17 '05 #1
2 1419
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" <lv*****@multconnect.com.br> wrote in message
news:ux**************@TK2MSFTNGP09.phx.gbl...
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
Nov 17 '05 #2
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" <so*****@spammingisevil.bad> escreveu na mensagem news:Ol**************@TK2MSFTNGP12.phx.gbl...
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" <lv*****@multconnect.com.br> wrote in message
news:ux**************@TK2MSFTNGP09.phx.gbl...
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

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Doug Farrell | last post: by
18 posts views Thread by Anchorman | last post: by
6 posts views Thread by Chris | last post: by
reply views Thread by FatboyCanteen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.