Microsoft provides programming examples for illustration only,
without warranty either expressed or implied. This includes, but is not limited
to, the implied warranties of merchantability or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language that is being demonstrated and with the tools that are used to create
and to debug procedures. Microsoft support engineers can help explain the
functionality of a particular procedure, but they will not modify these
examples to provide added functionality or construct procedures to meet your
specific requirements.
Server Push Using ASP
To implement Server Push using ASP, do the following:
- Save the following code as Push.asp in a folder with at
least Script access defined:
<% @Language="VBScript" %>
<%
Option Explicit
Dim strBoundary
' change the following string to whatever boundary you wish to use
strBoundary = "MSBOB"
' turn off buffering
Response.Buffer = False
' set the content type as a multipart document
Response.ContentType = "multipart/x-mixed-replace;boundary=" & strBoundary
' create a function to output the boundary
Sub WriteBoundary()
Response.Write "--" & strBoundary & vbCrLf
Response.Write "Content-Type: text/html" & vbCrLf & vbCrLf
End Sub
' this is a very unelegant sleep function just to create a short delay
Sub Sleep(tmpSeconds)
Dim dtmOne,dtmTwo
dtmOne = Now()
While DateDiff("s",dtmOne,dtmTwo) < tmpSeconds
dtmTwo = Now()
Wend
End Sub
%>
<% WriteBoundary %>
<html>
<body>
<p>First Page</p>
</body>
</html>
<%
Sleep 10
WriteBoundary
%>
<html>
<body>
<p>Second Page</p>
</body>
</html>
<%
Sleep 10
WriteBoundary
%>
<html>
<body>
<p>Third Page</p>
</body>
</html>
- Browse to the page using the Netscape Web browser. The
following behavior should occur:
- The first page displays for 10 seconds, and the browser
indicates that it is still loading a document.
- The second page displays for 10 seconds, and the
browser continues to indicate that it is still loading a
document.
- The third page displays, and the browser indicates that
the document loading has completed.
For more information on Server Push, Client Pull, and
Microsoft's Internet products, please see the following articles:
159650Â
(http://kbalertz.com/Feedback.aspx?kbNumber=159650/EN-US/
)
- Server Push Animation Not Supported in Internet Explorer
194083Â
(http://kbalertz.com/Feedback.aspx?kbNumber=194083/EN-US/
)
- FP98: How to Use Client Pull in FrontPage Web Documents
196471Â
(http://kbalertz.com/Feedback.aspx?kbNumber=196471/EN-US/
)
- FP2000: How to Use Client Pull in FrontPage Web Documents
240774Â
(http://kbalertz.com/Feedback.aspx?kbNumber=240774/EN-US/
)
- How to Enable Client Pull for Web Servers, Sites, and Folders
Microsoft
provides third-party contact information to help you find technical support.
This contact information may change without notice. Microsoft does not
guarantee the accuracy of this third-party contact
information.
The third-party products that are
discussed in this article are manufactured by companies that are independent of
Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the
performance or reliability of these products.