Page 248 - DCAP408_WEB_PROGRAMMING
P. 248
Web Programming
Notes Else
Response. Write “WRONG! Try again…”
End if
Hence, we are displaying dynamic content to visitors based on their choice. We can also set
other browser properties that deal with how to display the response.
Dissecting the Response Object
(Sending HTML to the Browser, Buffering ASP Pages, Sending the User to another page, Cookies,
Caching your ASP Pages)
Response allows you to send information to the browser and control how information is sent to
the browser. This has several methods and properties.
Sending HTML to the Browser
The most common use of the Response object is to send data to the client’s Web browser to be
displayed as part of a Web page. It is done in two ways. The first is to use the Write method; the
other is to use the shortcut
<%=_%>.
Task The ASP Response object is used to send output to the user from the server. Analyze
Self Assessment
Fill in the blanks:
1. The Response object methods give you potent control over what you can send to the
………………. from the web server.
2. ………………. sets the HTML header name to value.
3. ………………. allows you to send information to the browser and control how information
is sent to the browser.
4. The most common use of the Response object is to send data to the client’s Web browser to
be displayed as part of a ……………….
10.2 Response.Write
Without Response.Write, ASP is almost useless. The most important thing in using Response.
Write is that the string being written cannot contain “%>”. If you need to write a string that
contains “%>”, use “%\>”. Since we use %> to indicate the end of a block of ASP code, putting it
in your strings will confuse the system.
Like:
Response.Write (“<HR WIDTH=50%>”) will result in an error because the server will interpret
the “%>” as the closer to a block of ASP code.
Response.Write (“<HR WIDTH=50%\>”) will write “<HR WIDTH=50%>” to the HTTP.
242 LOVELY PROFESSIONAL UNIVERSITY