Below is a table of the Response Properties along with examples and explanations.
Response Properties
| Buffer |
Response.Buffer = True
Allows for the buffering of output |
| CacheControl |
response.cachecontrol= "Public"
Sets Cache to "public" or "Private" |
| CharSet |
response.charset= "windows-1252"
Sets the ISO character set |
| ContentType |
Response.contenttype= "Text/html"
Specifies the output MIME type (text/html, Text/plain, GIF, JPG) |
| Expires |
Response.expires=60
Sets page expiration in minutes |
| ExpiresAbsolute |
Response.expiresabsolute= #January 31, 2003 13:00:00#
Sets time certain for page to expire |
| IsClientConnected |
if (response.isclientconnected==true) {}
Determines if client is still connected |
| PICS |
((explanation)
Platform for Internet Content Selection |
| Status |
Response.status= "401 Unauthorized"
Sets Page Status |
You are are not required to set, alter, or utilize a single Response property if you don ' t want to. Having said that, they can is handy once in. I ' ve demonstrated all but two Properties in the script below.
By the way, set your properties before you begin output to the client.
Get started:
Below is the ASP script for Lesson 07.
<% @LANGUAGE = "JavaScript"%>
<%
response.buffer=true
response.cachecontrol= "Private"
response.charset= "windows-1252"
response.contenttype= "text/html"
response.expires=-1
Response.status= "OK"
%>
<HTML>
<BODY>
<%
if ( Response.isclientconnected==true)
{
Response.Write ("The client is Connected.<br>")
}
else
{
response.end ()
}
%>
<table border= "2" >
<TR>
<% For
(x=1;x<=200;x++)
{
Response.Write ("<TD>" + x + "</td>\r")
if (x%10==0)
{
response.clear ()
}
if (x%4==0)
{
Response.Write ("</tr></table>\r")
Response.Write ("<table border=\" 2\ ">")
Response.Write ("\r<tr>")
Response.Flush ()
}
%>
</TR></TABLE>
</BODY>
</HTML>
Click here to run the script in a new window. After you click onto the link, really study the numbers. If you are notice anything weird about the page, like missing numbers.
Response.Buffer:
Let's take the "Properties in order of" appearance in our script. Response.Buffer allows us to control the output via Response.Flush () and Response.Clear (). If you are haven ' t already, click onto the link to run the script. You'll get a strange output with some of the numbers missing. The missing numbers are to Response.Clear (). You are might notice that Response.Flush () slows down the server tremendously. Don ' t use this method without a reason.
Response.CacheControl:
CacheControl gives to authorize proxy servers to keep your page in cache. (That would is the "public" setting.) Likewise, it allows you to disallow proxy servers from caching your page. (That would is the "Private" setting). The default is "Private."
Response.Charset:
CharSet allows to specify the character set, for example: "ISO 8859-1".
Response.ContentType:
ContentType allows you to indicate the MIME type of the output. For example there is Text/plain and text/html. There is also GIF and JPEG.
Response.Expires:
Expires allows you to the "set an expiration" for the page. By setting the Expires property to-1, you are saying the page expired one minute before it is delivered. The browser would (hopefully) not store it in cache, but rather make a separate request to the server before re-displaying The page.
Response.Status:
If tomorrow Congress were to pass a-forbidding the use of Response.Status, I-I-am-life would go. If It makes you happy, use it.
response.isclientconnected:
IsClientConnected does exactly what it says. It returns a Boolean value that can be in the "if" statement.
Response.PICS:
PICS stands for Platform for Internet Content Selection. It allows pages to is rated for the presence of violence, sexuality, language and nudity. There are services on the Internet to rate your site. I ' ve never used one. I found a sample PICS string on the Internet and I converted to JavaScript.
response.pics ("(PICS-1.1 )
It's a long string and your browser may have wrapped the text down to a second line. If that's the case, then your have to pretend this entire PICS string is in one line.
Response.ExpiresAbsolute:
The
I did not demonstrate expiresabsolute in the script because I already used. ExpiresAbsolute does exactly the same thing as Expires, except it uses a date and time certain. (I couldn ' t the using both in the same script.) The only thing I would the ' pound signs (#) at the beginning and the date.