1.3 ASP Server Objects
As seen earlier, there are quite a few things you can do with traditional dynamic page directives and commands through the server-side pages that are included with ISAPI to access the Web server. But at the same time there are some obvious limitations.
For example, you can retrieve the value of the HTTP header that was sent over from the Request.ServerVariables collection to all the requests that accompanied the client. It is almost as #echo匹敌 as using SSI, with the primary advantage of returning these values as strings to the code (while the #echo instruction simply inserts the values into the page), so that they can be retrieved and maintained according to their desires. Many of the same parameters apply to #fsize and #flastmod directives, and you can easily get this information using scripts with objects in VBScript and the JScript script engine. In the following chapters you will see the relevant details.
#exec指令既非常有用, and subject to certain restrictions. In fact, the directive runs only system commands or custom CGI applications and does not provide a true control of the process to the script. ASP server objects provide an entirely new way to be more secure and easier to run other applications or components than #exec directives. Of course, for some cases, especially where you really need to execute an operating system command or an existing CGI application, #exec是无法替代的.
To study the server object, first outline all of its available methods and properties, and then discuss it in more detail.
4.3.1 ASP Server Object Members overview
The server object is designed specifically to handle specific tasks on the server, especially those related to the server's environment and processing activities. So there is only one property that provides information, but there are seven ways to format data in a server-specific way, manage the execution of other Web pages, manage the execution of external objects and components, and handle errors.
1. Properties of the server object
The only property of the server object is used to access the script timeout value for an executing ASP page, as shown in table 4-2:
Table 4-2 Properties and descriptions of server objects
Characteristics
Description
ScriptTimeout
Integral type. The default value is 90.
Sets or returns the number of seconds a script can execute before the server exits execution and reports an error. When this value is reached, the page is automatically stopped and the pages that contain errors that may go into the dead loop are deleted from memory or pages that wait for other resources for a long time. This prevents the server from overloading with the wrong page. You need to increase this value for a page that is running for a long time
2. Method of the Server object
The method of the server object is used to format data, manage Web page execution, and create other object instances, as shown in table 4-3.
Table 4-3 Server object method and description
Method
Description
CreateObject ("identifier")
Creates an instance of an object (a component, application, or Script object) identified by identifier that returns a reference that can be used in code. Can be used for a virtual application (Global.asa page) to create a session-level or application-layer-wide object. The object can be identified with its classid, such as "{clsid:bd96c556-65a3 ... 37A9} "or a ProgID string to identify, such as" ADODB. Connection "
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.