Use a VB.NET class from a classic ASP page

Posted on 2007-07-25
Last Modified: 2008-01-09
I am trying to create a very simple Class Library, compile it into a dll, and use its function in an asp page. I am following the following examples:

1) I cannot see it in my registry after compiling and running RegASM /tlb /codebase
2) My asp page code gives an error:
Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid class string
/sar/test.asp, line 7

MY VB CLASS CODE: (Project - MyClass)
Imports System.EnterpriseServices
Imports System.Runtime.InteropServices
Public Class Class1
Public Function Print(ByRef Text As String) As String
Return Text
End Function
End Class

Dim Obj
Set Obj = Server.CreateObject("MyClass.Class1")
Response.write Obj.Print("Jeremy")

ASSEMBLY CODE: (AssemblyInfo.vb)
Imports System
Imports System.Reflection
Imports System.EnterpriseServices
Imports System.Runtime.InteropServices

' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.

' Review the values of the assembly attributes

<Assembly: AssemblyTitle("MyClass")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("MyClass")>
<Assembly: AssemblyCopyright("Copyright ©  2007")>
<Assembly: AssemblyTrademark("")>
<Assembly: AssemblyKeyFile("C:\MyClass.snk")>
<Assembly: ComVisible(False)>
<Assembly: ApplicationName("MyClass")>
<Assembly: ApplicationActivation(ActivationOption.Server)>
<Assembly: ApplicationAccessControl(False, AccessChecksLevel:=AccessChecksLevelOption.ApplicationComponent)>

I have created a strong name for this build.

Can someone please help?
Question by:jpbivona
    1 Comment
    LVL 41

    Accepted Solution

    Those articles missed a step...   They didn't assign a GUID to the exposed method

    The concept of calling a .Net assembly from a classic ASP page is called a "COM Callable Wrapper" (CCW).   There are dozens of good examples out there on the interent.

    Here is one of the better ones:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now