VB and VBA Users Source Code: How to communicate directly with IIS in a VB DLL
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
How to communicate directly with IIS in a VB DLL
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Sunday, November 25, 2001
Hits:
917
Category:
Internet/Remote Comms
Article:
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.
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder