1

I have a Classic ASP web site that uses a VB6 COM object.

I want to create a new version of the COM object using .NET instead of VB6.

Cesar Daniel
  • 707
  • 1
  • 9
  • 25
  • 2
    Possible duplicate of [Building a COM interop library for ASP Classic using 4.0 framework and Visual Studio 2010](http://stackoverflow.com/questions/4923350/building-a-com-interop-library-for-asp-classic-using-4-0-framework-and-visual-st) – Shadow The GPT Wizard Apr 21 '16 at 06:26
  • This method is MUCH simpler than the one you refer. And keep in mind there is always more than 1 solution to a problem. – Cesar Daniel Apr 23 '16 at 02:50
  • @Mystico, the question is a duplicate. Your answer might not be. Why don't you post your method on that question? That way everybody benefits from your option in one place. That's why we close duplicate questions. – Euro Micelli Apr 24 '16 at 13:25
  • I just did that and now I will delete this question. Thanks! – Cesar Daniel Apr 26 '16 at 04:59

1 Answers1

1

[01]

Start Visual Studio 2015 (run as admin).

Create a new "Class Library" project.

Name it: "DotNetCom"

[02]

Add a new "COM Class" item.

Name it: "HelloCOM.vb"

[03]

Add a public function to "HelloCOM.vb".

For example:

Public Function Hello() As String
    Return "Hello there!"
End Function

[04]

Open "MyProject".

Go to "Compile".

Select "Target CPU: x86".

[05]

Build the "DotNetCom.dll".

[06]

Start Component Services.

Add a new COM+ application.

Name it: "DotNetCom".

[07]

Open the "DotNetCom" properties.

Go to the "Security Tab".

UNCHECK "Enforce access checks for this application".

[08]

Add a new component.

Select "DotNetComTest.tlb" (do NOT select "DotNetComTest.dll").

[09]

Use the COM object from the Classic ASP page.

<%
Dim HelloCOM
Set HelloCOM = Server.CreateObject("DotNetCom.HelloCOM")
Response.Write HelloCom.Hello
%>
Cesar Daniel
  • 707
  • 1
  • 9
  • 25
  • You don't need to register your COM object in Component Services unless your .NET object needs to access the ASP intrinsic objects (Response, Request, etc.) directly or you happen to need COM+ services such as transactions. And if you do need the IIS objects, you have to select all your objects in Component Services, Right click, Properties, Advanced, and check the "Allow IIS Intrinsic Properties" checkbox. – Euro Micelli Apr 24 '16 at 00:46