Quality Interior Design
 
EzTools Software Logo Quality Windows Programming Tools
Because Presentation is Everything
  
 
Home Buy Support About Us

WOW and HSP object injection 

 

  Products
WebGen  
SQLitePlus  
FileDb .NET Database  
ConfigDb  
EditListView Enhanced ListView  
WOW WebBrowser  
WOW.NET Component  
WOW and HSP  
HSP Object Injection  
Custom External Object  
Tutorial  

 

Download  (EzToolsLib)

We have already discussed how WOW and HSP can work together in your Windows programs.  Now lets take it a step further.  You can actually inject a COM object into the HSP programming scope, such that you can use it in the VBScript/JScript code during the processing of your ASP page.  And amazingly, you can do the same thing with .NET classes! The COM Interop service will transparently create the COM interface for you.

You can do this by using the HSP Server Object in your Application code to "inject" an object into the Server.SessionVar collection where it can be used by the ASP code.  This collection is "static", meaning that it exists for the lifetime of your application.  It allows you to provide your own COM object (must be scriptable) or .NET class, either created by you (such as a VB Class or Form object) or an existing COM object (such as an ADO Connection or Recordset).

Here is an example of how to inject an ADO Connection object. Suppose you have a global ADO Connection object in your application, and you want to use this same object in your ASP pages rather than create a new. This code would go in your VB project code:

Dim hspServer as new HSP.Server

'g_dbConn was created in your App's startup code
set hspServer.SessionVar("dbconn") = g_dbConn


Now you can access the Connection object in the ASP code

<%
Dim cnn

Set cnn = Server("dbconn")

cnn.Open "...
%>

Now lets take a .NET example.

m_hsp = New HSP.Server()

m_hsp.SessionVar("MyObj") = New MyDotNetClass()

Now you can access the .NET class object in the ASP code just like any COM object:

<%
Dim myObj

Set myObj= Server("MyObj")

myObj.DoSomething
%>




 

Copyright © EzTools Software All rights reserved. Trademarks and Disclaimer:
All trademarks belong to their respective companies.