====== Response Object ======
The response object is useful, feature rich, and subtle. We are going to focus on it's most fundamental capabilities -- the 20% you will use 80% of the time. The capabilities we think are vital include:
* response.write
* response.write alternate syntax <%= %> which allows ASP simply placed in HTML
* response.end which effectively halts a script in it's tracks.
* response.redirect which transfers control to another page
===== Buffers =====
Does this error message plague you?
Response object error 'ASP 0156 : 80004005'
Header Error
whatever.asp, line #
The HTTP headers are already written to the client browser. Any HTTP
header modifications must be made before writing page content.
The Simple Fix....
<%response.buffer=true%>
needs to be added as the very first line to any pages made by any HTML document that mixes redirects/headers and content. And buffering is a great idea anyway from overall server speed viewpoint see http://www.learnasp.com/advice/whybuffer.asp).
One drawback to <%response.buffer=true%> is if a page takes a while to compose (i.e. a couple thousand records from a database) people see nothing until the page is completely rendered. If a page takes 20 seconds to render, the browser user sees nothing until the 20th second! In that situation to avoid appearing as the page is dead, a well-placed
<%response.flush%> tell server to send HEADER + whatever text so far so lets readers see the portions of the page being built. Increasing percieved speed of database displays is explained at http://www.learnasp.com/learn/speedtables.asp by judicous use of flushing buffer.
==== NT4 and Win 2000 differences ====
NT4 <%buffer=false%> by default which hurts overall server speed (http://www.learnasp.com/advice/whybuffer.asp). Win 2000 <%buffer=true%> by default. A clever administrator can change NT4 registry so buffer=true for all scripts and will see major server performance improvements (see http://www.learnasp.com/learn/speedserver.asp for other ones).
===== Encoding =====
response.write server.htmlencode("Hyperion by Dan Simmons is a great novel")
response.write server.URLencode("Joe Smith & Hilda = a team")
===== Quotes =====
The response object is often used with a variety of syntax variations which we will detail here.
res4.asp
<%
' The response object can be used to write text a variety of ways
' depending on what style you personally prefer
' Various permutations of writing to the browser
response.write "