Introduction to ASP and the five main built-in objects

Source: Internet
Author: User
Tags object html tags iis log microsoft sql server sql client
objects | Built-in Objects | built-in Object catalog

1. ASP Basics

2. The five main objects of ASP

3. Request Object

4. Response objects

5. Server object

6. Application objects

7. Session Object

1. ASP Basics

Microsoft Active Server Pages, which is what readers call ASP, is a set of Microsoft-developed server-side scripting environments in which ASP is embedded in IIS and the latest version of ASP 3.0 is contained in IIS 5.0. With ASP, you can build dynamic, interactive, and efficient Web server applications in conjunction with HTML Web pages, ASP directives, and ActiveX controls. With ASP you don't have to worry about whether the client's browser will be able to run the code you write, because all programs will be executed on the server side, including all the scripting programs embedded in normal HTML. When the program is finished, the server only returns the results of the execution to the client browser, which reduces the burden on the client browser and greatly increases the speed of the interaction.

ASP summed up the following features:

Ø complete your Web site's applications quickly with HTML code, using simple scripting languages such as VBScript, JScript, and so on.

Ø no need to compile, easy to write, can be directly executed on the server side.

Ø the use of a common text editor can be written, in order to better team development, Microsoft has developed a special development tool Visual InterDev, it is an integrated Web application development system, including the development, distribution, and management of database-driven Web application software required for all the features.

The scripts used by øasp, VBScript, and JScript, are executed on the Web server, and the user-side browsers do not need to be able to execute these scripting languages.

Øasp's source program is not uploaded to the client's browser, so it can prevent the written program from being plagiarized, thereby improving the security of the site.

The Øactivex Server components has unlimited scalability. You can use the programming languages of Visual Basic, Java, Visual C + +, COBOL to write the ActiveX Server Component you need.

The ASP program can contain plain text, HTML tags, and script commands. You simply place the. asp program in the Web server's virtual directory (the directory must have executable permissions), you can access the ASP program via www.

Learn the basics of what ASPs need to know:

Ø Learn the use of Microsoft Visual InterDev software.

Install and use the øasp server.

Øasp is contained in IIS, IIS 4.0, like NT 4.0, contains IIS 3.0 for IIS 5.0 2.0,windows 2000. If you are a regular Windows 98 user, Microsoft has also developed a server Personal Web server designed to learn ASP, which is typically included in the ADD-INS/PWS directory of Windows 98, as long as you install the personal web Server,windows 98 users can still learn ASP programming.

Ø proficiency in HTTP and HTML.

Ø proficient in VBScript or JavaScript.

Ø proficient in database knowledge. For example, MicroSoft SQL Server, familiarize yourself with ADO and ODBC, and be familiar with Transact-SQL languages.

2. The five main objects of ASP

Request Object
Collection: QueryString, Form, cookies, servervariable

Main function: Read the data in the submission form or the data in cookies.

Response Object
Properties: Buffer, cookies, ContentType, Expires, ExpiresAbsolute, Status, isclientconnected, CacheControl

Methods: Write, redirect, end, flush, cookies, BinaryWrite, AddHeader, AppendToLog

Main function: Output text, data and cookies to the browser and control every stage in the process of transmitting the Web page.

Server Object
Properties: ScriptTimeout

Methods: CreateObject, MapPath, UrlEncode, HTMLencode

Primary role: Create COM objects and scripting components, and so on.

Application Object
Properties: Lock and Unlock

Main function: The Application object is used for sharing information between multiple users in the same application.

Session Object
Properties: SessionID and timeout

Method: Abandon

Primary role: Keep data for individual users.

3. Request Object

The Resquest object represents a request message sent to HTTP by each client program. In fact, the request object's functionality is one-way, and it can only receive data submitted by the client Web page, just as the response object functions.

Resquest receives data through two sets QueryString and form to retrieve the form's data, in which set, depending on the method attribute of the HTTP form that the Web page submits the data to, when the method property value is "get" Is querystring, and the method property value is "Post" with the form. When a specific collection name is omitted, the ASP searches the collection in the following order: QueryString-> Form-> Cookie->servervariables.






<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>


When the data is submitted to the server-side log.asp file, the request object is used in log.asp to get the data submitted by the user to determine whether the user is legitimate. log.asp files are 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 Successful! "

[1] [2] [3] [4] Next page



Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.