New features in ASP 3.0

Source: Internet
Author: User
Tags error handling eval execution flush ftp new features thread versions

If the reader is already familiar with ASP 2.0 and is looking for a list of actual changes in version 3.0, then this information will be found below. If the reader is a beginner of ASP, you can go over this chapter to the next chapter, where you will have a step-by-step Introduction to ASP objects and their usage.
ASP 3.0 New Features Overview
In ASP 3.0, there are some new features or experiences with significant changes or improvements.
1. Script-Free ASP
As mentioned earlier, ASP processing does not include any scripting. asp pages are fast, and if you are creating a site or Web application file that might eventually use ASP, it is best to have these files use the. asp file name extension, regardless of whether they contain server-side scripts or just static ( HTML and text) content.
2. New flow control capacity
So far, if you want to move execution to another ASP page, you have to use the Response.Redirect statement, which is implemented by sending a response to the client to instruct it to load the new page. However, this is troublesome to the client. And when the proxy server is used for the client, an error message is generated. ASP 3.0 provides two new methods for server objects that allow pages to be converted on the server without requiring new client requests.
Server.Transfer is the conversion execution to another page, and Server.Execute is executing another page and then returning control to the original page. You can access the original page's environment in a new page, including all ASP objects such as response and request, but you cannot access the page-wide variables. If the original page uses a transaction flag (in the open <% @ ...% > Element), the transaction's environment is passed to the new page. If the transaction flag for the second ASP file indicates that the transaction is supported or required, the existing transaction will be used without starting a new transaction.
3. Error handling and new ASPError objects
Provides configurable error handling by providing a custom ASP page that is automatically invoked using the Server.Transfer method. In this ASP page, Server.get last error can be used to return an instance of an ASP Error object that contains the details of the error, such as the description of the error and the associated line number.
4. Encoded ASP Script
ASP scripts and client scripts can now be encoded using the base 64 encryption method. A higher level of encryption plan will appear in the next new version of the ASP (note that this feature is implemented by VBScript 5.0 and the JScript 5.0 scripting engine, so that the engines are required to exist when the script is executed). The encoded script will be decoded by the scripting engine at run time. Therefore, you do not have to use other tools, although this is not a very secure encryption method, but can protect the script not by the general user browsing and copying.
5. A new way to include script files
In addition to using the <!--#Include ...--> element to enable server-side IIS to contain scripting code files, ASP 3.0 can also "contain" itself. <script > elements are used in conjunction with the runat= "server" and src = "path_and_filename" properties to contain server-based scripting code files. The relative physical path or virtual path can also be used in the SRC attribute:

6. Server Scriptlets
ASP 3.0 supports a powerful new scripting technology called the server Scriptlets. These are XML-formatted text files that reside on the server and can be used by the ASP as a generic COM object (that is, an Active server component). This makes it easier to implement the business logic script process for a Web application as a reusable component.
7. Active Server components for enhanced performance
Many of the Active server components in the ASP have been improved to provide better performance and additional functionality, an example of which is the new browser Capabilities component. In addition, there are some new components. For example, an XML parser enables an application to process data in XML format on the server. At the same time, it provides more compact integration of ADO and XML
(through the new ADO 2.5 version provided by Windows 2000), this provides new opportunities for storing and retrieving data in XML format.
8. Performance
The new version does a lot of work to improve the performance and scalability of ASP and IIS. This includes the Self Tuning feature in ASP, which detects blocking and automatically increases the number of available threads. When a request is blocked by an external resource during execution, the ASP is able to detect it and provide more threads for simultaneous execution of additional requests and continuation of normal processing. But
If the CPU becomes overloaded, the ASP reduces the number of available threads so that when too many non-blocking requests are executed concurrently, the number of thread switches is minimized.
Improvements to ASP 2.0
Some of the following features are from 2. Improved or upgraded in version 0.
1. Buffering defaults to open state
The ASP provides an optional output buffer. Starting with IIS 4.0, this allows the script to execute faster and provides control over the output flowing to the browser. In ASP 3.0 This improved performance is reflected by changing the default setting of the Response.Buffer property to True. The default state buffer is open, which means that the final output is sent to the client only when the process completes, or when the script calls the Response.Flush or Response.End method.
Note that you can turn off buffering by setting the Response.Buffer property to False. Only in this way can the XML formatted output be sent to the client, allowing the XML parser to start working after receiving the output. You can also use Response.Flush to send part of a large page so that users can see some of the output quickly.
2. Changes in response.isclientconnected
The Response.IsClientConnected property can be read without any content being sent to the client. In ASP 2.0, this returns accurate information only when at least a portion of the content is sent. This improvement addresses the problem that IIS must respond to each customer's request, even if the customer may have been transferred to another page or site. At the same time, if the customer does not reconnect within 3 seconds, the complete output information created on the server will be discarded.
3. query string with default document
If a user accesses a site without providing the name of the requested page, the default document (if any) will be sent to the client. However, if they provide a query string appended to the URL, this is ignored in earlier versions of the ASP, and the query substring in IIS 5.0 and ASP 3.0 is sent to the default page. For example, if the default page is default.asp in a directory with a URL:, both of the following cases send the name/value pair code=1274 to the Default.asp page:

4. Security of server-side Include files
Server-side include files are often used for sensitive information, such as database connection strings or other access details. A virtual path (that is, a URL rather than a complete physical Disk file path) can be used to specify these files. In this case, the previous ASP version does not check the security settings of the file and the user's certificate, in other words, the authorized (authenticated) user and the anonymous Web server account are not compared to the file's access control list. In IIS 5.0 and ASP 3.0, these certificates will be checked to prevent unauthorized access.
5. Configurable items to be moved to the metabase
Registry entries for ProcessorThreadMax and Errorstontlog in IIS 5.0 are moved to the metabase, and all ASP configurable parameters are available through Active Directory and Active Directory Service Interface (ADSI) Modified in the metabase.
6. Performance of two-thread objects in the application
To achieve optimal performance in an ASP with multiple concurrent requests, the component should be a two-threaded (both-threaded)-One-line apartment (single threaded Apartment,sta) and multithreaded unit (multi-threaded APARTMENT,MTA), and supports COM free-thread Marshaller (FTM). A two-thread COM object that does not support FTM, if stored in an ASP application state object, will cause the run to fail.
7. Release COM objects earlier
In IIS 5.0, instantiated objects or components can be released earlier. In IIS 4.0, a COM object can be freed only when the ASP has finished processing one page. In IIS 5.0, if a COM object does not use the OnEndPage method and the object's reference count reaches 0, the object is freed before processing completes.
8. ASP allows out-of-process components by default
Custom local server components can now be instantiated from IIS without having to change the metabase settings. The metabase properties that control the local server instantiation aspallowoutofproccomponents The default value is 1, and the earlier version of IIS is 0.
9. COM object Security
IIS uses the new cloaking feature provided by COM +, so the local server application instantiated from ASP can run in the security context of the original customer. In earlier versions, the security environment was assigned to the local server COM object and depended on the identity of the calling process.
10. The default time component runs outside the process
In earlier versions of the ASP, all components created in the ASP page environment were run in the process by default.
To compromise between the performance of the component and the security of the Web server, for a virtual application, you can choose from the three options application protection in the Properties dialog box:
Low (IIS Process)
All application executables and components of this set of ASP virtual applications run in the process (that is, memory space) of the Web server executable file (Inetinfo.exe). As a result, the Web server risks being affected by the failure of an executable file or component, yet this provides the fastest and least resource-wasting application execution options.
Medium (Pooled)-This is the default setting
All application executables and components of this set of ASP virtual applications run in the process (that is, memory space) of a single shared DLLHost.exe instance. This protects the Web server executable (Inetinfo.exe) from the risk of failure of any one executable file or component. However, failure of an executable file or component can cause the DLLHost.exe process to fail, and all other executable files and components that reside there will fail.
High (Isolated)
All application executables and components of the ASP virtual application for this setting run in the process (that is, memory space) of a single DLLHost.exe instance, but each ASP application has its own DLLHost.exe instance. DLLHost.exe is unique to the application, which protects the Web server executable from the risk of failure of any one executable or component, and protects the virtual application from the failure of executable files or components of other virtual applications. Microsoft recommends hosting up to 10 isolated virtual applications on any Web server.
The recommended configuration is to run a mission-critical application in their own process, high (Isolated), and all remaining applications running in a shared process, medium (Pooled). You can also set execute permissions for scripts and components that compose each virtual application (execute Permission), and three options are:
1 None: Cannot run script or executable file in this virtual application. In practical terms, this provides a way to quickly and easily block an application if necessary.
2 Scripts only: script files, such as ASP, IDC, or others, are allowed to run in this virtual application and the executable file cannot run.
3 Scripts and Executables: Allows any script and executable file to run in this virtual application.
New features in VBScript 5.0
Features that can be applied in ASP include those provided by the scripting engine, which means that VBScript improvements can also be applied in ASP. The improvements to VBScript are described below.
1. Using a class in a script
The Complete VB Class (Class) model is implemented in VBScript, but the notable exception is the scripting events on the ASP server side. You can create classes in your scripts so that their properties and methods can be used for the rest of the code on the page, for example:

This code produces the following results:
Value of Halfvalue property is 21
Result of GetResult method is 42
2. With structure
VBScript 5.0 supports the with structure, making code that accesses several properties or methods of an object more compact:

3. String evaluation
The Eval function (which used to be available only in JavaScript and JScript) is now supported in VBScript 5.0. It allows you to create a string that contains script code, the value can be true or false, and you can get a result after execution:

4. Statement execution
The new Execute function allows script code in a string to be executed in the same way as the Eval function, but does not return a result. It can be used to dynamically create procedures that are executed later in code, such as:

A carriage return (as shown in the program) or a colon character ":" can be used to separate the statements in a string.
5. Setting up regional
The new setlocale method can be used to change the current region of the scripting engine, displaying special locale-specific characters, such as accent-accented characters or characters from different character sets.

6. Regular expressions
VBScript 5.0 now supports regular expressions (which used to be available only in JavaScript, JScript, and other languages). RegExp objects are commonly used to create and execute regular expressions, such as:

7. Setting up an event handler in client VBScript
This is not a scripting technique that is directly applied to ASP, and this new feature is useful when writing client-side VBScript. You can now dynamically specify a function or subroutine to associate with an event. For example, suppose the name of a function is MyFunction (), and you can assign it to the button's onclick event:

This provides similar functionality in JavaScript and JScript, and functions can be dynamically specified as attributes of an object.
8. On Error Goto 0 in VBScript
Although this technique has not been documented previously, it can be used in the existing VBScript version (with a V-B background and a curious person may have already discovered the secret). It is now recorded in the document and can be used to "close" custom error handling on the Errorresume next after executing on. As a result, any subsequent errors will raise a browser-level or server-level error and the corresponding dialog/response.
New features in JScript 5.0
The only change in JScript 5.0 is the introduction of error handling.
The Java-style try and catch structures are supported in JScript 5.0. For example:

The built-in JScript Error object has 3 properties that define the last Run-time error. You can use them in a catch block to get more information about the error.

If you want to throw your own error, you can throw an error (or exception) with a custom exception object. However, because there are no built-in exception objects, you must define a structure yourself:

Such an object can be used to throw a custom exception in the page. This is accomplished by using the Throw keyword and then examining the type of exception in the CATCH block:

Other new features
There are several new features that can already be used in IIS 5.0.
1. DAV (Distributed Authoring and Versioning)
This standard is created by the Internet Engineering Task Force (IETF) and is currently version 1.0. It allows authors to create and maintain our B pages and other documents together in several different locations. It is used to provide upload (upload) and download access, and to control the version number so that the work process can be managed appropriately, IE contains the features of integration with the DAV in IIS 5.0. However, versioning is not yet implemented in the Iete standard and in the current version of IIS 5.0.
2. Reference type library
In the past, you used server-side include files to add constants from a type library such as script objects, ADO, or MSMQ to an ASP page. This is necessary because the ASP cannot create a reference to a type library or component DLL as VB does. In IIS 5.0, you do not have to use the include file for constants. You can place an HTML annotation-style element in the
This will make the constants in the specified file available in the current ASP page (although this is a new feature in IIS 5.0, it is already available in IIS 4.0, although it is not recorded in the document).
3. FTP download continued transmission
The FTP service has now finally provided the download renewal function. If a file is partially downloaded and stopped, it can continue downloading from the breakpoint. This means that files that have not finished downloading do not need to download the entire file again.
4. HTTP Compression
IIS is now able to automate the HTTP data stream compression of static or dynamically generated files and cache compressed static files. This provides faster response and reduces network load when communicating with properly prepared clients.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.