Global.asa Reference (v)-typelibrary statement

Source: Internet
Author: User
Tags constant contains iis reference
The reference ActiveX component often describes the constants supported by that component in the type library. A type library is a file that contains a letter about the objects and types supported by the ActiveX component
Interest. If a user's Web application relies on an ActiveX object that has already declared a type in the type library, it can declare its type in the Global.asa file. This
After the sample is done, you can reference the data type that has been declared in the type library from any script within the scope of the application.

For more information about using constants in ASP, see "Working with variables and constants."

Grammar
<!--METADATA type= "TypeLib"
file= "File"
Uuid= "Typelibraryuuid"
version= "Majorversionnumber.minorversionnumber"
Lcid= "LocaleID"
-->
Parameters
File
The absolute path of the type library. If the parameter and the Typelibraryuuid parameter are provided, file is used to identify the type library. File parameter and
Typelibraryuuid parameters are required.

Typelibraryuuid
Unique identification of the type library unification. Both the file parameter and the Typelibraryuuid parameter are required.

Majorversionnumber
Used to select a version. If the desired version is not found, an error is returned. This parameter is optional.

Minorversionnumber
Used to select a version. If the desired version is not found, an error is returned. This parameter is optional.

LocaleID
field identification, for the type library. If the desired field is not found, an error is returned. This parameter is optional.
Error message
The server can return the following error message.

Error description
The type library specified by ASP 0222 is invalid. The METADATA tag contains an invalid type library designation.
The type library was not found in ASP 0223. METADATA contains a type library that does not match the registry key.
The ASP 0224 type library could not be loaded. The ASP was unable to load the type library specified in the METADATA tag.
The ASP 0225 type library cannot overlap. ASP was unable to create the type library wrapper object from the types libraries specified in the METADATA tag.


Comments
It is best to write the METADATA tag at the beginning of the Global.asa file. However, both internal and external SCRIPT tags can appear in the Global.asa
Any location in the file.

You can avoid ambiguous references to constants by adding the name of the type library to the front of the constant. For example, Adodb.aderritemnotfound would be better than
adErrItemNotFound more clearly.

If you create a Global.asa file using Microsoft Visual InterDev, the METADATA tag will contain optional startspan and endspan off
Key word. IIS ignores these two keywords.

Example
The mycomponent in the following example is written in Visual Basic 5.0. MyComponent uses the following statements to define constant myerror.

Public Const Myerror = ' You are the not using mycomponent correctly. '

The type library is contained in Mycomponent.lib, which is installed in the following directory.

C:\MyComponent

The following METADATA tag is included in the Global.asa file for the MYAPP application. The example uses the optional Startspan and endspan tags. and
IIS does not need these two tags.

<!--METADATA type= "TypeLib"
File= "MyComponent.lib"
-->

Now, any ASP in the MYAPP application contains the following script:

<%
Dim MyVar
Set MyVar = Server.CreateObject ("Mycomponent.myclass")
Currentreturn = Myvar.mymethod
If Currentreturn = False
Response.Write (Myerror)
End If
%>



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.