In the first three, we mainly introduce the four built-in objects provided by ASP:
L Response object: Sends information to the browser.
L Request object: Access to information sent from the browser to the server, such as obtaining form data.
L Session object: stores, reads specific user dialog information.
L Application Object: stores and reads the application information shared by all users.
There are also server objects and ObjectContext objects that we will learn in later instances (hint: in fact, you can already use the knowledge to write online chat room). The content of this talk is using ASP's ActiveX Server components (component).
First, Browser capabilities Component (browser capability component):
We know that different browsers may support different functions, such as some browsers support the framework, and some do not support it. With this component, you can check the capabilities of your browser to make your Web page compete for different browsers for different pages (such as displaying pages without frame for browsers that do not support frame). The use of this component is very simple, it should be noted that to properly use the component, you must ensure that the Browscap.ini file is the latest (in fact, each browser and its characteristics are listed in this file, you open it to see it), otherwise the result may be very far, As in the Win98 second Edition, the IE5.0 shown in the following example is Netscape. This file is generally located under the Web server "\Winnt\System32\Inetsrv", the latest version to yun_qi_img/468x60_1.gif the location of the advertising picture, but also for the local graphics file
Yun_qi_img/www.163.com
http://www.sina.com.cn/
New Long
30
Http://61.139.77.73/images/canon.gif can also use local pictures, such as ... /images/flag.gif
http://www.canon.com.cn/
Canon
50
In this example, a total of three pictures (picture size 468x60) and links, each link description of four lines, the actual use, you can do the same, add more pictures.
<% ' wuf26.asp
url = request.querystring ("url")
Response.Redirect (URL)
%>
Wuf26.asp is the simplest handler and you can add more code to the actual needs.
Run, the original use of this component is also very simple, you have to do is to get their own AdrSet.txt files. With this component, you can even design an ad exchange home that is now very fashionable.
Iv. Content Linking components
Obviously this component is related to the link and if you want to know exactly what this component is for, I am afraid it is too hasty to cite a classic example: if you read a book online, you will not be unfamiliar with the following links: The 1th chapter, the 2nd Chapter 、...、 the previous chapter, the next chapter (or the previous page, the last page) and so on. What we're going to do now is to set up jumps quickly and easily between these links.
First build a link list text file, such as Urllist.txt
Wuf23.asp 1th: File operations (Files Access component)
Wuf28.asp 2nd: Content Linking component usage examples
Wuf22.asp 3rd Chapter: Browser capability components
The link URL address and description are separated by a Tab key. The following wuf27.asp is used to list all the links in Urllist.txt.
<% @LANGUAGE = VBScript%>
<% Option Explicit%>
<body>
<ul>
<%
Dim Nextlink, Count
' Create Content linking components
Set Nextlink = Server.CreateObject ("MSWC. Nextlink ")
' Get the number of links in the file Urllist.txt
Count = Nextlink.getlistcount ("Urllist.txt")
Dim URL, DSCR, I
For I = 1 to Count
url = Nextlink.getnthurl ("Urllist.txt", I) ' Get hyperlink
DSCR = Nextlink.getnthdescription ("Urllist.txt", I) ' Get text description
Response.Write "<li><a href =" "& URL &" ">" & Dscr & "</a>" & vbCrLf
Next
%>
</ul></body>Then, take wuf28.asp as an example to show how to automatically implement the previous chapter and the next chapter jump.
<% @LANGUAGE = VBScript%>
<% Option Explicit%>
<body>
<p> here is the body of the 2nd Chapter ............</p>
<% ' Each file contains the following sentence, the automatic link is implemented%>
<!--#include file= "wuf29.asp"-->
</body>Here the last sentence Plus to be able to achieve automatic jump, the core in the wuf29.asp.
<%
Dim Nextlink, Rank
Set Nextlink = Server.CreateObject ("MSWC. Nextlink ")
' The current link is in the urllist.txt in the first few
Rank = Nextlink.getlistindex ("Urllist.txt")
Response.Write "
If (Rank > 1) Then ' rank = 1 does not exist previous page
Response.Write "|<a href=" "& Nextlink.getpreviousurl (" Urllist.txt ") &" "" > Previous chapter </a>| "
End If
if (Rank < Nextlink.getlistcount ("Urllist.txt")) Then ' rank at the end, then there is no next page
Response.Write "|<a href=" "& Nextlink.getnexturl (" Urllist.txt ") &" "" > Next Chapter </a>| "
End If
%>
Running this example, you can immediately understand the role of this component, in short, you do not need to write a "previous chapter", "The next chapter" on each page, completely through the wuf29.asp to fix, is not very convenient?! Otherwise, if you manually modify the link, it is not too much trouble a time?
Now you should understand that the Internet a large number of free counters, free message board, free chat rooms, ad exchange nets and so on ..., the principle is so much, can not worship.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.