Total members 11895 |It is currently Fri Dec 27, 2024 5:18 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Based on your web page objective you can send bytes to the client browser as chunks or as one piece. In case when you OFF the buffer the server will wait until the entire page processing is done then later one it will send the content, while in the ON buffer server status, bytes will be sent as groups and not reason to wait until the end of process execution. On IIS version buffer is ON by default. You can check if it is ON or OFF using the current date as in the follows code:
Code:
<%@ Language=VBScript %>
 
<% Response.Buffer = TRUE %>

<
html><head>
<
title>Date and Time Page</title>
</
head>
<
body >

<%
Dim iterator, jumper 
Response
.Write(now)

For iterator=1 to 10000000
jumper 
= jumper +1 to waste some time
Next 

Response
.Write "<br> Current Date: " & now
%>

</
body>
</
html>
 

This is an example of a server-side script that utilizes the VBScript language to display the current date and time on a web page. The script is embedded within an HTML document, and the VBScript code is executed on the server before the page is sent to the client's browser. The first line of the script specifies the language used in the script, in this case, it's VBScript. The following line enables the buffering of the output, which means that the server will not send the response to the client until the script is finished executing. The script then displays the current date and time using the "Response.Write" method, passing the "now" function, which returns the current date and time. The script then uses a "For" loop to iterate through a range of numbers, and a variable named "jumper" is used to waste some time, this loop is used to simulate a process that takes some time to execute. Finally, the script displays the current date and time again, this time after the loop has finished executing, using the "Response.Write" method, passing the "now" function. In summary, this script is an example of how VBScript can be used to display the current date and time on a web page and how to use loops in VBScript. It also shows how to use the "Response.Write" method to send output to the client's browser. It's worth noting that this script is not considered best practice as it is not optimized and can cause performance issues on the server, for example, the loop that is used to waste time will consume a lot of resources.

In the code above we print the current date/time twice but with a difference of processing between them using for loop, because we set <% Response.Buffer = TRUE %> you will see two different times. You can set <% Response.Buffer = FALSE %> and see the output. You can’t change the buffer to OFF if you already set it to ON and such case you will error code ASP 0157 (0x80004005).



This script is using VBScript, which is a scripting language developed by Microsoft and is primarily used for server-side scripting in Microsoft's Internet Information Services (IIS) and ASP (Active Server Pages) environments. VBScript is not a widely used language today and it's recommended to use other scripting languages like JavaScript, Python, and PHP for web development. It's also worth noting that this script is using the "now" function to get the current date and time, this function is a built-in function in VBScript and it's equivalent to the "DateTime.Now" property in .Net. It's also important to note that this script is sending the output to the client's browser using the "Response.Write" method, this method is a built-in method of the ASP "Response" object, it's used to send output to the client's browser, this method is considered legacy and it's recommended to use other ways to send output to the client like using template engines or server-side rendering. It's also worth mentioning that this script is not handling any errors that may occur during the execution, it's important to handle any errors that may occur to provide a better user experience and also to prevent any security issues. In summary, this script is an example of how VBScript can be used for server-side scripting, but it's not considered a best practice due to the limitations of the language and the lack of error handling. It's recommended to use other scripting languages and frameworks for web development



_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Disabling and enabling buffers for ASP
 Disabling Obtrusive Messages     -  
 Web enabling of windows application     -  



Topic Tags

ASP Time
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com