October 17, 2002 - Using the Global Response Object
October 17, 2002|
Using the Global Response Object
Tips: October 2002
Yehuda Shiran, Ph.D.
Response object is used to pass information to the user. These are its properties:
Buffer: a Boolean directing the server (if
true) to buffer its output until all server scripts on the current page have been processed, or until the
End method has been called.
ContentType: the type of content sent back (text/HTML, Excel, etc.)
Expires: the time in minutes after which the user's cache for this page is invalid.
ExpiresAbsolute: the absolute date and time for expiration of the user's cache for this page.
Status: returns the status line (defined in the HTTP specification of the server).
Response object supports the following methods:
AddHeader: adds an HTML header with a specified string value.
AppendToLog: appends a string to the Web server log file.
BinaryWrite: write binary data (i.e. Excel file).
Clear: clears any buffered HTML output.
End: stops processing the script.
Flush: sends all the information in the buffer.
Redirect: redirects the user to another URL.
Write: writes into the HTML stream. You can use
Response.write("Hello There") or
Response object includes one collection,
Cookies. In IBuySpy, we use these cookies to persistently save the user name:
Response.Cookies["IBuySpy_FullName"].Value = Server.HtmlEncode(Name.Text);