|
[Lifetime of variables][Applications][The
Global.asa file][ASP Built-in Objects][Response
Object]
[Request Objects][Content
Linking]
Request Object
When a browser asks for a page from a server,
it is called a request. The Request Object is used to get information
from the user.
Syntax
|
Request.collection
Request.property
Request.method
|
Collection
|
Collection
|
Description
|
|
ClientCertificate
|
Holds field values stored in the client
certificate
|
|
Cookies(name)
|
Holds cookie values
|
|
Form(element_name)
|
Holds form (input) values. The form
must use the post method
|
|
QueryString(variable_name)
|
Holds variable values in the query string
|
|
ServerVariables(server_variable)
|
Holds server variable values
|
Properties
|
Property
|
Description
|
|
TotalBytes
|
Holds the total number of bytes the
client is sending in the body of the request
|
Method
|
Method
|
Description
|
|
BinaryRead
|
Fetches the data that is sent to the
server from the client as part of a post request
|
Simple AdRotator Example
This example shows how to use the AdRotator component to display a
different advertisement image, each time a user visits or refreshes the
page.
<html>
<body>
<%
set adrotator=Server.CreateObject("MSWC.AdRotator")
adrotator.Border="2"
adrotator.Clickable=false
Response.Write(adrotator.GetAdvertisement("text/advertisements.txt"))
%>
<p>
NOTE: Because the images are changed randomly, and because this page
has only four images to choose from, sometimes the page will display
the same advertisement twice in a row.
</p>
<p>
<a href="text/advertisements.txt"><img border="0"
src="../images/btn_view_text.gif"></a>
</p>
</body>
</html>
AdRotator - The Images are Hyperlinks
This example shows how to use the AdRotator component to display a
different advertisement image, each time a user visits or refreshes the
page. In addition, the images are hyperlinks.
<%
url=Request.QueryString("url")
If url<>"" then Response.Redirect(url)
%>
<html>
<body>
<%
set adrotator=Server.CreateObject("MSWC.AdRotator")
adrotator.TargetFrame="target='_blank'"
response.write(adrotator.GetAdvertisement("text/advertisements2.txt"))
%>
<p>
NOTE: Because the images are changed randomly, and because this page
has only four images to choose from, sometimes the page will display
the same advertisement twice in a row.
</p>
<p>
<a href="text/advertisements2.txt"><img border="0"
src="../images/btn_view_text.gif"></a>
</p>
</body>
</html>
The Browser Capabilities Component
This component determines the type, capabilities and version of each
browser that visits your site.
<html>
<body>
<%
Set MyBrow=Server.CreateObject("MSWC.BrowserType")
%>
<table border="1" width="65%">
<tr>
<td width="52%">Client OS</td>
<td width="48%"><%=MyBrow.platform%></td>
</tr>
<tr>
<td >Web Browser</td>
<td ><%=MyBrow.browser%></td>
</tr>
<tr>
<td>Browser version</td>
<td><%=MyBrow.version%></td>
</tr>
<tr>
<td>Frame support?</td>
<td><%=MyBrow.frames%></td>
</tr>
<tr>
<td>Table support?</td>
<td><%=MyBrow.tables%></td>
</tr>
<tr>
<td>Sound support?</td>
<td><%=MyBrow.backgroundsounds%></td>
</tr>
<tr>
<td>Cookies support?</td>
<td><%=MyBrow.cookies%></td>
</tr>
<tr>
<td>VBScript support?</td>
<td><%=MyBrow.vbscript%></td>
</tr>
<tr>
<td>JavaScript support?</td>
<td><%=MyBrow.javascript%></td>
</tr>
</table>
</body>
</html>
The Content Rotator Component
This component displays a different HTML content string each time
a user visits or refreshes the page.
<html>
<body>
<p><b>Note:</b> This example won't work because ASP
3.0 is not installed on our server.
</p>
<%
set cr=server.createobject("MSWC.ContentRotator")
response.write(cr.ChooseContent("text/textads.txt"))
%>
<p>
NOTE: Because the content strings are changed randomly in the text file,
and this page has only four content strings to choose from, sometimes
the page will display the same content strings twice in a row.
</p>
<p>
<a href="text/textads.txt"><img border="0"
src="../images/btn_view_text.gif"></a>
</p>
</body>
</html>
|