Iis|server|web|window uses ASP to develop Web applications based on Windows NT Server and IIS
Costind Command and Technical College Han Zhengqing Chanming
Absrtact: This paper compares the structure and performance differences between CGI ISAPI and ASP, and introduces the development of ASP
The general process of WEB applications.
Key words: ASP CGI ISAPI IIS
First, the preface
The advent and development of internet/intranet and Web technology provide a fast and effective way to exchange and share information.
method, but the information provided on the internet/intranet is mostly static web pages, for a Web application
Developers, the most concern is how to enhance the dynamic and interactivity of the Web page. Active Server
Pages is a Microsoft-developed server-side scripting environment based on Windows NT Server and IIS, scripts
Run on a Web server, and the browser does not handle the script, it's just a completely compliant HTML
Format Web page, which provides the possibility for more browsers to access Web servers of different types.
Second, ASP's architecture
Common Gateway Interface CGI and Microsoft Information Server application interface ISAPI is development interaction
Web applications commonly used in two types of interface, CGI is based on the Web server and the relationship between the database services
The end of the process, it can complete the bottom of the database operation, the customer through the get/post to the Web server to submit clothing
Request, the server-side daemon passes the parameter to STDIN and environment variables to pass parameters to the specified
CGI program, execution results will be returned to the customer in HTML format. For most Internet applications, CGI
Provides a good platform for development applications, but CGI has two things we can't avoid in terms of performance
Trap
(1) A CGI program cannot be shared by multiple clients, and new processes must be started for new requests, see
Fig. 1 as customer requests increase, there will be more concurrent processes, which is a great
Waste, but also increased the burden on the server, reducing performance.
(2) does not provide permanent contextual information. For example: Users need to query a large database, the result can be
Can be thousands of rows of data, if the user wants to display only 10 rows of data at a time, but the CGI after outputting 10 rows of data
Stop execution, to display the next 10 rows of data must be executed again CGI program, this way obviously inefficient
High.
ISAPI has better performance than CGI because the ISAPI application exists as a dynamic link library and is added at startup
into memory and is in the same system space as the Web server process, see figure. 2, which consumes less system resources.
Efficiency increases, but it also poses a greater risk that the ISAPI process and the server process are in the same system
Process space, so a violation can cause the Web server to crash. In addition to either the CGI program
Or ISAPI programs are essentially independent of HTML, developed entirely in another language, with a lot of work and
HTML is not tightly integrated.
ASP is based on Microsoft Windows NT 4.0 and Microsoft Internet information Server
3.0 (IIS3.0) 's Open scripting development environment, which blends HTML and scripting development Well,
Improve the flexibility of programming, reduce the difficulty of development. The script in ASP runs on the Web server side, not
Traditionally running in a client browser, this approach makes it unnecessary for the client's browser to worry about server-side web pages making
With what script, ASP will generate a Web page that conforms to the HTML standard to send back to the client, ASP in the performance aspect
The advantages are embodied in the following points:
(1) Fully integrated with the HTML;
(2) Create simple, do not need to compile and link, the script can run directly under the ASP environment;
(3) Object-oriented, function can be extended by ActiveX server component;
(4) Because the script executes on the server side, it can support almost any kind of browser.
ASP is superior in performance and efficiency to CGI, ISAPI, which is mainly due to its advanced architecture, see figure. 3 ASP
It is built directly on a Web server and is run as a service for a Web server, supports multiple users, and many
Thread. HTTP protocol is a stateless protocol, the Web server can not remember the client browser has previously sent
Request information, each request of the customer is independent, there is no connection between each other, so many of the server
Time is spent on processing requests, and service efficiency is affected. ASP has a strong session management mechanism,
It can realize the information sharing among the requests and improve the efficiency. ASP in the security aspect also made the careful examination
Consider, including: Set virtual Directory access rights, user identity detection, hidden scripts and other measures. ASP supports a variety of
Scripts, which are more commonly used in VBScript and JScript.
Third, the development of ASP application
(1) System requirements:
Before installing ASP, the system must meet one of the following three requirements:
· Windows NT Server 4.0 +service Pack 3 +iis 3.0
· Windows NT WorkStation 4.0 +peer WEB Server 3.0
· Windows Personal WEB Server 1.0 a
(2) Composition of ASP applications
An ASP file takes the. asp as its extension instead of the previous one. Included in HTML or. htm,.asp Files: Text
This, HTML tags, and script commands. But an ASP application is not just an. asp file, it also includes
Global.asa files,. inc files, and some other resource files. VBScript is the ASP default scripting language
In VBScript, in addition to the message box (MSGBOX) and the input box (InputBox) can not be used in ASP outside its
He scripts can be run directly in the ASP environment, in addition, the ASP also provides five built-in objects for customers to visit
Ask a variety of resources to provide great convenience. These five objects are:
The extension of ASP function relies on the support of component (Component), the component can use Vb,java, and MFC
and other tools developed. ASP has provided customers with five components, by creating instances of these artifacts, users can benefit
With the special function of the component. These five components are:
· Database access widget (data access Component)
· Advertising Flip Widget (Ad Rotator Component)
· Content Connection widget (linking Component)
· Files Access Widget (file access Component)
· Browser Performance widget (Brower capabilitycomponent)
(3) Application Example
The following is to provide customers with telephone records enquiries for example, the ASP access to an ODBC database of the web should
Use. This web application can be completed as long as the following two sections are included: (1) Creating a Web server-side. asp script,
Implement customer Query page. (2) Create a Web server-side. asp script to return the query results. Database mining
With an Access database, the Dsn=phone,table=phone_record,phone_record table contains seven items
Capacity: Main call number, call time, called number, called location, length of call, rates and charges.
Query Web page source code:
<HTML>
<HEAD><TITLE> User Information Query </TITLE></HEAD>
<body bgcolor= #FFFFFF >
<CENTER><H3> Billing System User information query </H3></CENTER>
<HR>
<form method=post action= "query.asp" >
<P> Please select the item to query:
<select name= "section" >
<option selected> the main call number
<OPTION> called number
<OPTION> called location
</SELECT>
<P> equals
<input Type=text name=content><br>
<p><input type=submit value= "SUBMIT form" ><input type=reset value= "RESET form" >
</FORM>
<BR>
</BODY>
</HTML>
Query results page source code:
<HTML>
<HEAD><TITLE> User Information Query </TITLE></HEAD>
<body bgcolor= #FFFFFF >
<CENTER><HI> User Information Query </H1><CENTER><BR>
<%section1=request.form ("section") ' Fetch query parameters
Content1=request.form ("content")
%>
<%set conn=server.createobject ("ADODB"). Connection ")" Establish database Access objects
Conn.Open ' phone ' opens the database
Sql= "SELECT * from Phone_record where" & section1 & "= '" & Content1 & "'"
Set Rs=conn.execute (SQL) ' Execute query
%>
<p> Inquiry Time:<%=now%>
<table border=2>
<font color= #213554 ><TR>
<%for i=0 to RS. Fields.count-1%>
<td><b><%=rs (i). Name%>&l