The technical features and the usage method of ASP

Source: Internet
Author: User
Tags define object execution functions odbc sql ole access
A few years ago, the industry's only channel for dynamic home page Publishing was the CGI (Common Ga teway Interface) model. The ensuing technology scenarios, such as ISAPI, NSAPI, and JDBC, are more advanced than CGI, but are not yet available for rapid development, timely maintenance, and widespread technology coverage, as measured by the technical realities of the Enterprise Network (Intranet). The advent of ASP technology makes the dynamic Interactive Web homepage design a pleasant and enjoyable work. As long as a few lines of script statements, the background of the database information can be published to the Internet/intranet, in the programming and Web script readability is significantly better than the traditional technical solutions.
ASP is an acronym for Active Server Pages (dynamic servers home), a server-side scripting environment that interprets scripts on Web servers on the site to produce and execute dynamic, interactive, and efficient site server applications. ASP is capable of all kinds of dynamic Data publishing based on Microsoft Web server.
The difference between ASP method and traditional static homepage
After the information system is integrated into the Internet/intranet framework, the first problem to be solved is to access the background database information through the Web page. All applications are segmented into the form of pages, and user interactions are implemented in the form of submitting forms, which requires a strong dynamic data publishing capability on the Web site. However, the current Web services are still focused on providing "static" home page content. The so-called "static" refers to the site's homepage content is "fixed", can not be based on user needs and actual situation to make the corresponding changes. When the browser requests the home page from the Web server for the site through the HTTP protocol of the Internet, the site server passes the Designed static HTML file to the browser. To update the contents of the home page, you can update the HTML file data only in a manual way that is not online.
ASP designed a dynamic home page, can receive user submissions and response, the data can be changed with the actual situation, no need to manually update the Web page file to meet the application needs. For example, when you fill out a form in a browser and submit an HTTP request, you can ask to execute a form-setting application on the site server, not just a simple HTML file. The application analyzes the input data for the form and transmits the corresponding execution result (usually the result set of the database lookup) to the browser in HTML format based on the different data content. The data of the database can change at any time, but the application that executes on the server does not need to change, the Web information that the client gets will always keep fresh charm.
The working principle and configuration of ASP
As shown in the figure, when a user requests a *.asp home page, the Web server should invoke an HTTP request, call the ASP engine, and interpret the requested file. When you encounter any ActiveX scripting-compliant scripts such as VBScript and JScript, the ASP engine invokes the appropriate scripting engine for processing. If the script instruction contains a request to access the database, it is connected with the background database through ODBC, and the database access component performs the visiting operation. ASP script is executed on the server side, it automatically generates the homepage of the HTML language according to the result set of the visit, in response to the user's request. All relevant publishing work is the responsibility of the Web server. Figure 1 Active Server pages working schematic
It is necessary to pay attention to the specific operational details of the visit to the library. When you encounter a script command to visit the library, ASP talks to the database via ActiveX component ADO (ActiveX Data Objects) (ADO is based on Microsoft's new database API, OLE DB, the current OLE DB interacts with an existing ODBC database through an ODBC engine, and further OLE DB versions will deal directly with the database, no longer through the ODBC engine, and dynamically generate an HTML page for the execution results to return to the server side in response to the browser's request. What is seen in the client browser is a picture of pure htm l performance, such as the contents of a field in a background database table that is represented by a table. Because ASP combines scripting language, you can access the ACTI Vex component programmatically, and has the ability to automatically generate HTML on site, so it becomes an effective tool to build dynamic Web sites.
On a structural relationship, ASP is dealing with databases through ODBC. Therefore, to the upper level can be compatible with various database systems. And for the lower level, ASP generated HTML for the client browser has a wide range of adaptability. But the ASP is picky about the Web server itself, which may seem like a flaw, but it might actually be a business strategy-it only supports Web servers under Microsoft's various operating systems, and the minimum version is:
· Windows NT Server 4.0:microsoftⅱs (Internet informatio n server) 3.0;
· Windows NT Workstation 4.0:microsoft Peer Web Services 3.0;
· Windows 95:microsoft PWS (Personal Web Server) 1.0, Chinese Win95 should be with Chinese PWS.
The installation of ASP is divided into Windows NT and Windows 952. For NT, IIS and ActiveX Server Pages are included in service Pack 3, and for Win95 you can use the ActiveX Server Pages installation option under the Visual Studio server artifacts. After the installation is successful, an ActiveX Se RVer Pages Roadmap homepage will be found in Program Manager to guide you through the learning and use of ASP.
Features and functions of ASP
From the technical aspect of software, the characteristics of ASP are as follows:
1. No need to compile ASP scripts integrated in HTML, easy to generate, without compiling or linking can be directly interpreted execution.
2. Easy to build using a regular text editor (such as Notepad under Windows), you can design a *.asp page. If you consider from the work efficiency, you may choose Visual InterDev with visual editing ability.
3. Browser-independent browser users can browse the home page designed by ASP by using browsers that interpret regular HTML code. ASP scripts are executed on the site server side, and the client's browser does not need to support it. Therefore, if you do not download from the server to observe the *.asp home page, the correct page content can not be seen at the browser end.
4. object-oriented in ASP scripts can easily reference system components and ASP's built-in components, but also by customizing the ActiveX server Component (ActiveX servers components) to expand functionality.
5. Compatible with any ActiveX scripting language, in addition to being designed using VBScript and JScript languages, other scripting languages provided by third parties can be used in a plug-in manner.
6. The source code does not leak the ASP script executes on the server, uploads to the user browser is only the ASP execution result generated regular HTML code, this can guarantee painstakingly writes the program code not to be stolen by others.
From the perspective of application, ASP is like the following functions:
1. Process form input from the browser to the site server.
2. Access and edit server-side database tables. You can use the browser to enter, update, and delete data from the database of the site server.
3. Read and write Site server files, the realization of visitors counters, motto and other functions.
4. Provide advertising carousel, access to browser information, URL table management, such as built-in functions.
5. Cookies read and write to the client's hard disk file to record the user's data.
6. It is possible to share information among multiple home pages to develop complex business site applications.
7. Use simple scripting languages such as VBScript or JScript to combine HTML code to quickly complete your site's applications. Script language is executed through the site server, producing or changing the scripting language that is executed on the client.
8. The ability to expand functionality allows you to make ActiveX Server component to meet your special needs by using a variety of programming languages, such as Visual Basic, Java, visual C + +, and more.
The technology realization method of ADO Visiting Library
ADO (ActiveX Data Objects) is a set of optimized Access database dedicated objects, providing a complete site database access solution for ASP. It can be used on the server side to provide home page content containing database information. By executing SQL commands, users are allowed to enter, update, and delete database information for the site server in the browser screen.
ADO uses the built-in Recordsets object as the primary interface for data. ADO can use VBScript, Jscrip T language to control access to the database, as well as the output display of query results.
ADO can connect to multiple ODBC-enabled databases, such as SQL Server, Oracle, Info Rmix, and so on.
When used, you first need to establish the appropriate DSN (data source name) in ODBC in Control Panel. To select a system data source name, specify the driver you are using, such as SQL Server, enter the DSN name in the data source name, and select the server and database.
The design essentials of accessing a database using ADO is to master several typical statements of ASP scripts, which are:
1. Define Database Components. There are two ways to define:
• Use "Server.CreateObject" to establish a connected object.
Set conn=server.createobject ("ADODB. Connection ")
• Use <object

[1] [2] 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.