Paip. Script components for improving ASP programming Security
In the past, for Script Security, you can use VB and VC to write COM components .. Here, a new technology is available, that is, scripts.
Component, simply put, a script can also be used to write COM components ..
Script parts provide you with a convenient way to create COM parts using the scripting language (VBScript) and JScript.
Script parts can be used as com parts for applications, and any other applications that support com parts. Listed below
The content to be discussed in this tutorial.
The Windows Script part technology includes the following parts:
The Program (scrobj. dll) used to send com requests to the script part during running of the script part. According to the com terminology,
Scrobj. dll is executed as the inproc server of the script component.
Script part file (this is A. WSC file ). The script part file is an XML (Extensible Markup Language) file, where the package
Contains information about the com part type to be created (that is, the interface handler to be used ). Then, according to the processing program
Provides available functions. You can write scripts in the script parts to implement these interfaces.
When the script component is running, the program can be used as an entry to the Host application.
You can use Remote COM component technology, DCOM, and remote rpc call .. Strong.
Create an ASP script part. You only need to create a script part according to the content described in the script part file. Use
<Implements> element to implement the ASP interface handler, that is, set the type attribute of the <implements> element
"Asp ". This provides access to ASP objects (response, request, server, session, and
Application. In the ASP script part, these objects can be used as directly on the ASP page.
----------------- Script component call :------------------
<% Set wscasp = Createobject ("aspscriptlet") %>
<P> the current date is <% = wscasp. adddate () %> </P>
Among them, aspscriptlet is the self-built COM component ..
The source code of the COM component is as follows:
<Component id = "aspscriptlet">
<Registration progid = "aspscriptlet"/>
<Public>
<Property name = "applicationvar1"/>
<Method name = "adddate"/>
</Public>
<Implements type = "asp"/>
<Script language = "VBScript">
<! [CDATA [
Dim applicationvar1
Applicationvar1 = Application ("var1 ")
Sub adddate ()
Response. Write (date)
End sub
]>
</SCRIPT>
</Component>