Seventh ASP Built-in object request

Source: Internet
Author: User
Tags array header http request odbc object model variables variable microsoft frontpage
from the beginning of this article, the author starts from the ASP, and analyzes the characteristics and methods of the ASP's six built-in objects and various components in detail. Before we begin to learn the ASP's built-in objects and components, let us understand some basic concepts, which will be of great help to you in your future study. Take a look at the following table:
Active Server A collection of server-side technologies delivered with Windows NT. These technologies provide consistent server-side components, scripting models, and a set of integrated system services for component application management, database access, transactions, and messaging.
Active Server Pages (ASP) A server-side scripting environment that runs ActiveX scripts and ActiveX components on the server. Developers can combine scripts and components to create web-based applications.
Activex The rich Microsoft technical terminology that allows developers to create interactive components for the world Wide Web. A set of language-independent interoperability technologies that allow software components written in different languages to work together in a networked environment. The key elements of ActiveX are the Component Object Model (COM) and the Distributed Component Object Model (DCOM). These technologies have been licensed by open organizations and have been ported to many platforms.
Ado An Active data object. A set of object-based data access interfaces optimized for data-centric applications based on the Internet. ADO is based on published specifications and is shipped with Microsoft Internet Information Server and Microsoft Visual InterDev.
Dsn The name of the data source. Open Database Interface (ODBC) is used to reference the logical name of the driver or other information required to access the data. The name used by an Internet Information Server to connect to an ODBC data source, such as a SQL Server database.
Event: Events Any action that the program responds to by a user or ActiveX control. General events include pressing keyboard keys, selecting buttons by using the mouse click, and other mouse actions. Programmers write code that responds to these actions.
Object: Objects In object-oriented programming, a variable consisting of operations and data as a complete entity. Objects are based on a specific model in which the client uses the object's services to access the object's data through an interface of a set of methods or related functions. The client can then call these methods to perform an operation.
Odbc Open Database interface. An application programming interface that allows applications to access data from the standard specifications of existing data sources that are accessed from a variety of cross-platform data.
Sql The Structured Query language is structured query Language. Defines and accesses international standards for relational databases.
  
What is an object? It's not about your partner or girlfriend you're in love with. In object-oriented programming, an object is a variable consisting of operations and data as a complete entity. Objects are based on a specific model in which the client uses the object's services to access the data of the object through an interface of a set of methods or related functions, and the client can then call these methods to perform an operation. ActiveX components are the key to building WEB applications, and components provide the objects that perform tasks in scripts. An ActiveX component is a file that contains code to perform an item or a set of tasks, because the components can perform common tasks so that programmers do not have to create the code to perform those tasks themselves. You can leverage components as scripts and basic building blocks for web-based applications. As long as you know how to access the objects that the component provides, even a novice who writes scripts can write scripts without knowing how the components work. In summary, components enable you to write powerful scripts without learning to program. A component is an executable code contained in a dynamic-link library. dll or executable file. exe. A component can provide one or more objects and the methods and properties of an object. To use the object provided by the component, create an instance of the object and assign the new instance to the variable name. Using the ASP's Server.CreateObject method to create an instance of an object, a variable assignment instruction using a scripting language can be named for an object instance. The following example: Set db=server.createobject ("ADODB.")    Connection ") Here the variable db is the object instance that the ASP program creates to access the database. Active Server Pages provides built-in objects that you can use in scripts. These objects make it easier for users to gather information that is sent through a browser, respond to browsers, and store user information, thereby getting the object developer out of a lot of tedious work.    The current ASP version provides a total of six built-in objects, let's go through the examples to learn separately. A Request object can use the request object to access any information that is delivered based on an HTTP request, including parameters, cookies, and user authentication that are passed from the HTML table using the POST method or the Get method.    The Request object enables you to access the binary data that the client sends to the server. Request syntax: request[. Collection | properties | methods] (variables) Here the author will pick some common object syntax for analysis 1, Form form collection by using the POST method of the form to retrieve the mail to the HTTP request is  The value of the table element in the text.  Syntax Request.Form (element) [(index) |.    Count argument element specifies the name of the table element to retrieve for the collection. The index optional parameter, which you can use to access one of several values in a parameter. It can be 1 to request.form (parameter).    Any integer between Count. The number Form collection of elements in the Count collection is indexed by the name of the parameter in the body of the request. The value of Request.Form (element) is an array of all element values in the request body. by calling Request.Form (element). Count to determine the number of values in the parameter. If the parameter is not associated with more than one value, the count is 1. If the argument is not found, the count is 0. To reference a single value in a TABLE element that has multiple values, you must specify the index value. The index argument can be from 1 to Request.Form (element). Any number in Count.    If you refer to one of several table parameters without specifying the index value, the returned data will be a comma-delimited string. You can use the Restatement character to display all the data values in the table request. For example, the user fills out a form by specifying several values, as shown in the following figure.  For hobby parameters, you can use the following script to retrieve these values.   < html> < head>< title></title>
All_http All HTTP header files sent by the client.
Content_length The length of the content that the client emits.
Content_Type The data type of the content. such as: "text/html". Used with queries with additional information, such as HTTP query get, POST, and put.
Local_addr Returns the server address that accepts the request. This variable is important if the address used by the request is found on a multihomed machine that binds multiple IP addresses.
Logon_User User logged in to the Windows NT account.
Query_string Query the information after the question mark (?) in the HTTP request.
Remote_addr The IP address of the remote host (client) that issued the request.
Remote_host The host (client) name that issued the request. If the server does not have this information, it will be set to an empty mote_addr variable.
Request_method This method is used to make a request. The equivalent of, post, etc. for HTTP.
server_name The server host name, DNS alias, or IP address that appears in the self-referencing URL.
Server_port The port number on which the request was sent.
We can print out all the server environment variables using the following script. < table> < tr>< td>< b>server variable</b></td>< td>< B>Value</B&G t;</td></tr><% for per name in Request.ServerVariables%> < tr>< td> <%= name%> ; </td>< td> <%= request.servervariables (name)%> </td></tr></table> <% Next %> today we have studied in detail the ASP in the object of the request object, this is the ASP program to use the most frequent objects, I hope everyone in the class after a lot of practice.


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.