?
Solved

Use a VB.NET class from a classic ASP page

Posted on 2007-07-25
3
Medium Priority
?
249 Views
Last Modified: 2008-01-09
I am trying to create a very simple VB.net Class Library, compile it into a dll, and use its function in an asp page. I am following the following examples:
http://weblogs.asp.net/dneimke/archive/2004/01/31/65330.aspx
http://www.codeproject.com/useritems/dotnetcomponentandasp.asp

MY PROBLEMS:
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

MY ASP PAGE CODE:
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?
0
Comment
Question by:jpbivona
1 Comment
 
LVL 41

Accepted Solution

by:
graye earned 2000 total points
ID: 19608115
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:  http://www.codeproject.com/dotnet/nettocom.asp
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

809 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