Calling EAServer Components from ASP.NET
Calling EAServer Components from ASP.NET
Create an ASP.NET Web Application by using the New Project wizard:


After creating the Web Application, add the Jaguar proxy reference
to this project. Do so by selecting Add Reference from the Project menu
options:

Select Jaguar ActiveX proxy under the COM components tab. This will
add the Jaguar ActiveX proxy to your Web Application.


Add the syntax for calling a component in Class1:
Imports JaguarTypeLibrary
Public Class Class1
Inherits System.Web.UI.Page
Public Function component_creation() As Object
Dim theURL
Dim aORB As ORB
Dim aManager
Dim aSession
Dim aFactory
Dim obj
Dim sz, sz_action As String
theURL = "iiop://localhost:9000"
aORB = Server.CreateObject("Jaguar.ORB")
aORB.init("")
aManager = aORB.string_to_object(theURL).Narrow_("SessionManager/Manager")
aSession = aManager.createSession("jagadmin", "powernow").Narrow_("SessionManager/Session")
aFactory = aSession.lookup("smith/n_smithtest")
obj = aFactory.Create().Narrow_("smith/n_smithtest")
'sz_action = Request.Form("dwcust_action")
Return obj
' sz = obj.uf_get()
End Function
Public Function Destroy_Component()
Dim aORB As ORB
Dim aManager
Dim aSession
Dim aFactory
Dim obj
aFactory = Nothing
aSession = Nothing
aManager = Nothing
aORB = Nothing
obj = Nothing
End Function
End Class
Add code to the Page_load event of the WebForm:
Public Class WebForm1
Inherits System.Web.UI.Page
' Protected myComponent As New Component1
Protected TestClass As New Class1
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
'Put user code to initialize the page here
Dim obj
Dim sz, sz_action, sz_context As String
' Connect to the component
obj = TestClass.component_creation()
sz_action = Request.Form("dwcust_action")
sz_context = Request.Form("dwcust_context")
'Call method on component
sz = obj.uf_html(sz_action, sz_context)
TestClass.Destroy_Component()
Response.Write(sz)
End Sub
End class
Add the page directive to WebForm. This will set the page to run in a single-thread apartment and allow access to legacy COM components:
<%@ Page aspcompat = true %>
Build and Run the Web Application.

