Update message on web page while processing

M

Mark

I'm building a web utility to do some processing that will run for several
hours. Assume I have a valid reason for using the web for the utility.
During the process I'd like to display an update on the job's status while
not stopping the process that is running. It does not need to be pretty.
I'd be quite happy with a quick Response.Write("Job has finished consuming
300 of 9356 bananas"); or similar. I don't care if the message is replaced
or appended to.

What is the easiest (doesn't need to be pretty on the UI) method for posting
information back to the page while continuing to process?

Thanks!

Mark
 
J

Jester98x

Mark said:
I'm building a web utility to do some processing that will run for several
hours. Assume I have a valid reason for using the web for the utility.
During the process I'd like to display an update on the job's status while
not stopping the process that is running. It does not need to be pretty.
I'd be quite happy with a quick Response.Write("Job has finished consuming
300 of 9356 bananas"); or similar. I don't care if the message is replaced
or appended to.

What is the easiest (doesn't need to be pretty on the UI) method for posting
information back to the page while continuing to process?

Thanks!

Mark

Hi Mark,

One of the simplest solutions for this is to have the web application
trigger a standard application, i.e. a command line application on the
server, which will actually do the processing for you. You could then
refresh a web page every few seconds, or minutes, which will check for
an indicator that the processing is complete.

The command line application, in this situation, could write a simple
text file to a directory to indicate that it has finished.

There are problems with this solution, i.e. what happens if the
application is launched more than once. I used to run a similar set up
some years ago for live reports that took 10 minutes or so to complete.
The web application fired off a PERL script that did the processing,
while the web page checked for the existance of a named file. The file
name was was made up with a unique identifier and this name was passed
to the PERL script so that any one running the report would see their
version. Not ideal but it did the job at the time.

Hopefully this will give you some pointers as to what you might be able
to achieve.

Steve
 
J

John Timney \(MVP\)

Can you use the web to start the process and check on it, and use a service
on the web server to do the job - that makes life very simple and will make
creating a solution very simple also. Otherwise, spawn your intial request
into a frameset, and have one frame page request the job starts, and the
other polling for status. You could use an iframe if you dont want to use a
traditional frameset.

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
 
M

Mark

Thanks to both of you for your replies. Unfortunately I'm bound to actually
running the process from the web page.

If I go the Frame route ... let's talk about the page that monitors the job.
What javascript or HTML tag is required to autopost back every minute or so
to check on the status of the job?

Thanks again.

Mark
 
L

LosManos

hejdig.

Search for AJAX. MSs implementation was called Atlas earlier.
AJAX makes heavy use of HTTPRequest.

http://groups.google.com/group/comp...ttprequest+javascript&rnum=1#a681be5498cd0af3
andor
http://jibbering.com/2002/4/httprequest.html
andor
http://javascript.faqts.com/

Note that IE6 behaves differently from the rest of the world but this is
supposedly fixed in IE7.

Serverside has to start a new process which writes its progress to a
database or something.
Clientside starts a timer to make HTTPRequests to a page that checks the
status of the process.

HTH

/OF
 
S

Steven Cheng[MSFT]

Hi Mark,

As other members have mentioned, you have many approaches to query the
running status from server-side:

** use html meta tag to refresh the page constantly:

http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm

** use client script to postback the html page e.g.

document.forms[0].submit()

http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml

** In ASP.NET 2.0, there provides AJAX like script callback can even help
you call a server-side page fucntion without postback the page.e.g.

#Implementing Client Callbacks Without Postbacks in ASP.NET Web Pages
http://msdn2.microsoft.com/en-us/library/ms178208.aspx

Hope also helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top