Recommended: Common code editing of ASP Calculate the size of the character len() is a character that calculates one, a letter and a lenb() are two letters and characters that are referenced as follows: function getlen(str) n=0 for i=1 to
Table of Contents1. ASP Basics
2. Five major objects of ASP
3. Request object
4. Response object
5. Server Objects
6. Application Object
7. Session Object
1. ASP Basics
Microsoft Active Server Pages, which is what readers call ASP, is a server-side scripting environment developed by Microsoft. ASP is contained in IIS, and the latest version of ASP 3.0 is contained in IIS 5.0. Through ASP, you can combine HTML web pages, ASP instructions and ActiveX controls to create dynamic, interactive and efficient WEB server applications. With ASP you don't have to worry about whether the client's browser can run the code you wrote, because all programs will be executed on the server side, including all scripting programs embedded in normal HTML. After the program is executed, the server only returns the execution result to the client browser, which reduces the burden on the client browser and greatly improves the speed of interaction.
ASP has the following characteristics:
Ø Use simple and easy-to-understand scripting languages such as VBScript and JScript, combined with HTML code to quickly complete the application of the website.
Ø No need to compile, easy to write, can be executed directly on the server side.
Ø It can be written using a normal text editor. In order to better carry out team development, Microsoft has specially developed a set of development tools, Visual InterDev, which is an integrated web application software development system, including all the functions required to develop, issue, and manage database-driven web application software.
Ø The scripts VbScript and JScript used by ASP are both executed on the web server, and the browser on the user side does not need to be able to execute these script languages.
Ø The source program of ASP will not be transmitted to the client browser, so the written program can be avoided from being plagiarized by others, thereby improving the security of the website.
Ø ActiveX Server Components has unlimited scalability. You can use Visual Basic, Java, Visual C, CoBol and other programming languages to write the ActiveX Server Component you need.
ASP programs can contain plain text, HTML tags and script commands. You just need to place the .asp program in the virtual directory of the web server (this directory must have executable permissions) and you can access the ASP program through WWW.
Basic knowledge to master when learning ASP:
Ø Learn to use Microsoft Visual InterDev software.
Ø Installation and use of ASP server.
Ø ASP is contained in IIS. IIS 4.0 of NT 4.0 contains IIS 2.0, and IIS 5.0 of Windows 2000 contains IIS 3.0. It doesn't matter if you are an ordinary Windows 98 user. Microsoft has also developed a Personal Web Server specifically for learning ASP. It is generally included in the add-ins/pws directory of the official version of Windows 98. As long as you install Personal Web Server, Windows 98 users can still learn ASP programming.
Ø Proficient in HTTP and HTML.
Ø Proficient in VBScript or JavaScript.
Ø Proficient in database knowledge. For example: Microsoft SQL Server, you must be familiar with ADO and ODBC and familiar with Transact-SQL language.
2. Five major objects of ASP
Request Object
Collection: querystring, Form, cookies, Servervariable
Main function: read data in the submission form or data in cookies.
Response Object
Attributes: buffer, cookies, ContentType, Expires, ExpiresAbsolute, Status, IsClientConnected, CacheControl
Methods: write, redirect, end, flush, cookies, BinaryWrite, AddHeader, AppendToLog
Main functions: output text, data and cookies to the browser and control every stage of the web page delivery process.
Server Object
Attribute: scripttimeout
Methods: CreateObject, mappath, URLencode, HTMLencode
Main function: create COM objects and Scripting components, etc.
Application Object
Properties: lock and unlock
Main function: Application objects are used to share information between multiple users in the same application.
Session Object
Properties: SessionID and TimeOut
Method: Abandon
Main function: maintain data for a single user.
3. Request object
The Resquest object represents a request message sent to HTTP by each client program. In fact, the function of the Request object is one-way, and it can only receive data submitted by the client's web page, which is exactly the opposite of the function of the Response object.
When Resquest receives data, two sets QueryString and Form are used to retrieve the data of the form. Which set is used depends on the Method property of the HTTP form submitted by the web page. When the Method property value is Get, QueryString is used, and when the Method property value is Post, Form is used. When the specific collection name is omitted, the ASP will search the collection in the following order: QueryString -> Form -> Cookie -> ServerVariables.
<html>
<head>
</head>
<body>
<form aciton=log.asp method=Get name=login>
<input type=text name=logid>
<input type=text name=password>
<input type=submit name=submit1 value=submit>
</form>
</body>
</html>
After the data is submitted to the log.asp file on the server side, use the Request object in the log.asp to obtain the data submitted by the user and determine whether the user is legal. The log.asp file is as follows:
<%
dim User
dim Passwd
User=Request.QueryString(logid)
Passwd=Request.QueryString(password)
if User=jeff then
if Passwd=123456 then
Response.write Login successfully!
Share: Use Asp to hide file paths to realize anti-theft chain If we know the actual path of a static file such as: http://www.xx.com/download/51windows.pdf, if the server does not have special restrictions, we can download it effortlessly! When the website provides 51windows.pdf download, how