Server-side processing in dynamic pages

Source: Internet
Author: User
Dynamic | server


The previous chapters have studied some of the ASP's built-in objects. The main objects are request, Response, session and Application object. Another major object in ASP is the server object. This chapter focuses on the background knowledge and usage of this object.
The server object provides a way to extend the functionality of an ASP page by using instances and other external objects and components in servers-side scripts. In fact, many people think this object is the main factor that makes the ASP popular. The introduction of server objects is significant, which means that ASPs do not have to provide all the attributes that people need. It can invoke other applications and components to complete the specified work.
This fits well with the overall goal of building an application composed of independent objects, rather than building the "everything Can be done" program that is commonly seen as exhausting hard disk space. Not only in the computer world, the whole world is moving toward components and "Plug and Play" concepts. Now, when a car or a television set fails, a technician or engineer may well pull out faulty parts and insert a new one, so the work of the car maintenance staff or the maintenance staff of the TV set becomes object-oriented.
However, IIS also supports many traditional methods of using external objects and interacting with the server environment. This is a specific exception, and these methods are not really ASP components, but are often useful and are well integrated with the ASP through some of the new features of the server object. This chapter briefly reviews these traditional methods and then introduces the ASP server objects in detail.
The main contents of this chapter are:
· Background knowledge and usage of traditional server-side include (SSI) directives.
· The task that the server object is to complete, and the comparison with SSI.
· How to use Server object instances, external components, and applications.
· How to use the server object to execute encapsulated scripts or other ASP pages.
· How to use the server object to manage errors that occur in a script.
· How to use the server object to complete a format conversion with HTML or HTTP compatibility.
The server object is part of the error handling process in an ASP page and is new in IIS 5.0 and ASP 3.0. This chapter describes how the object works. Because there is a separate chapter (chapter 7th) devoted to all issues related to debugging and error handling. So this chapter simply discusses the error handling method and is limited to the processes directly involved in the server object.

4.1 Server-side processing in dynamic pages
As far as server-side processing is concerned, ASP is a relatively new technique for generating dynamic web pages. What does a dynamic page mean? The progress of client-related functionality is not considered for the moment, nor is it discussed with client script, Java applets, Dynamic HTML, or ActiveX controls. The dynamic page here is specifically the page that the server responds to the client request, and the pages generated each time may be different depending on the situation.
To give a simple example, create a page that contains only the current date and time. Each time the page is requested, a different value is displayed because the date and time depend on the server's clock, or on a resource that provides the date and time (for example, a stand-alone server or a standard clock from the Internet). Of course, dynamic pages are actually much more complicated than this, perhaps displaying the current value of the database record or a summary of the mail messages waiting on the mail server. It is important that the server not only read an unformatted HTML page, or text files on a disk, but also send them to customers, and you must do some work to create the page.

Internet Server Application Programming interface
The 1th chapter introduces some methods for creating dynamic pages. The traditional technique is to use an interface with a Web server, which is called the Internet Server Application programming interface (Internet Servers application programming Interface,isapi).
ISAPI can be used to execute other applications that use the C-style stdin and stdout data flow functions to read the values requested by the client and create a response from the Web server. All that an ISAPI application must do is write the text and HTML of the corresponding results page and output it to the Web server through the STDOUT function. In fact, the things that are really done inside an ASP dll are more object-oriented.
IIS runs the ISAPI application and script interpreter since it started. It provides a special interpreter dynamic link library, giving access to the server's request and response to another method, although subject to a certain limit. It is implemented through the server-side include directives because they are executed on the server and the results are contained in the response that is sent to the client. This feature is implemented in IIS through a dynamic link library named Ssinc.dll. By default, IIS maps to this dynamic link library any page that has a file name extension of. shtml,. shtm, or. stm. Open the Properties dialog box for the Default Web site and click the Configuration button in application setting to see this mapping, as shown in Figure 4-1:

In this way, pages with these mapped file extensions will be sent to ssinc.dll for processing. As a result, all server-side include statements are executed on the page, and the results, if any, are inserted into the server's response, which is inserted into the page that the client receives.
Because these files are mapped to Ssinc.dll files rather than to the ASP Dynamic link library (asp.dll), all ASP code on these pages will be ignored and routed to the client in its original state, and the client will be able to see the scripts. However, there is a way to avoid this in the version of ASP 3.0, which is studied later when discussing the execute and transfer methods of the server object.




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.