ow to communicate directly with IIS in a VB DLL
The following article describes how to to communicate directly with IIS’s intrinsic objects from your VB DLL.
For example, suppose on your ASP page you instanciate an object called “myDll.myObject”:
Set oMyObject = Server.CreateObject(“myDll.myObject”)
‘Other code here
If you want this DLL to be able to talk directly to the IIS objects (eg. the Reponse and Request objects) then you will need to add a reference to ‘Microsoft Active Server Pages Object Library’ in the DLL. Next, use the following code as a template in the DLL:
Private zoRequest As ASPTypeLibrary.Request
Private zoResponse As ASPTypeLibrary.Response
private zoAspScripting As ASPTypeLibrary.ScriptingContext
‘This is automatically called when your DLL is instantiated by the ASP page
Sub OnStartPage(AspScripting As ASPTypeLibrary.ScriptingContext)
On Error GoTo ErrFailed
‘Store the various ASP object you want to use
Set zoAspScripting = AspScripting
Set zoResponse = zoAspScripting .Response
Set zoRequest = zoAspScripting .Request
‘Error handling here
‘This is also automatically called when the ASP page releases its
‘reference to your DLL.
‘Release references to the ASP objects
Set zoResponse = Nothing
Set zoRequest = Nothing
Set zoAspScripting = Nothing
Using this code you can write directly from you DLL to the web browser of the client using the Response Object.