Visual Basic > Applications-VBA
How to communicate directly with IIS in a VB DLL
How 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": <% DIM oMyObject 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: Option Explicit 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 Exit Sub ErrFailed: 'Error handling here End Sub 'This is also automatically called when the ASP page releases its 'reference to your DLL. Sub OnEndPage() 'Release references to the ASP objects Set zoResponse = Nothing Set zoRequest = Nothing Set zoAspScripting = Nothing End Sub Using this code you can write directly from you DLL to the web browser of the client using the Response Object.
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows