[thelist] Sharing data between ASP and JavaScripts

David.Cantrell at Gunter.AF.mil David.Cantrell at Gunter.AF.mil
Wed Feb 26 12:40:01 CST 2003


> WHAT IS "SERVER PUSH"?  I NEVER HEARD OF THAT TERM BEFORE. DO
> YOU HAVE AN EXAMPLE OF IT FOR ME TO LOOK AT?

Server push is a technique where the server never closes the connection, and
continues to push data to the user. This was used in the early days of the
web (1994-ish) to create animated images. By pointing the image tag at a CGI
script, and the CGI script loading (or generating) a series of images in
succession, and not closing the connection immediately, the CGI script could
push the images one frame at a time to the browser.

Needless to say, it was really, really slow for the most part. ;)

It was used for other things as well, but this was probably it's most famous
use.

> In either case, pressing the STOP button requests a process
> to set the variable your `do..` loop is testing for and
> return the "what now?" page.
>
> THIS ABOVE PARAGRAPH SUMS UP JUST WHAT I NEED TO DO.  THE
> REASON FOR THE NECESSITY IS IN CASE THE USER ACCIDENTLY
> CHOOSES A REPORT CRITERIA THAT WILL TAKE HOURS AND THEY NEED
> A WAY OUT OF THE MESS.

Hmm. Here's my point: the minute you hit that button/link, the browser is
going to (a) CLOSE THE EXISTING CONNECTION with the server, and then (b)
CREATE A NEW CONNECTION. Now, the ASP process has no way of knowing if the
browser has closed the connection, so that hours-long process will keep
trucking along until... Well, until the script timeout set in IIS or in the
script itself. Default is usually 90 seconds, but if you set this to hours,
then it may well keep running for hours.

It sounds to me like you are trying to apply desktop-style development ideas
to web development, and it doesn't work that way. The client and server are
NOT in a stateful connection, and script that executes on the browser is
TOTALLY SEPARATE from script that executes on the server. Client script
executes pretty much after the connection has been closed, because the HTML
and scripts have been delivered by the connection. Once loaded by the
browser the scripts execute. The scripts can contain ASP-generated variable
info because the ASP process on the server processed the ASP script,
replaced the ASP variable references with actual data, then sent the output
(the final HTML+Javascript file) to IIS which forwarded it to your browser.
They don't remain in any form of communication whatsoever.

Now having said all that, I may be wrong here, and am perfectly willing to
admit I'm wrong. But until I'm *proven* wrong, I'll stand by my earlier
statement: you can't do that.

At least, not in ASP. :(

Sorry,
-dave



More information about the thelist mailing list