Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a VB class in a ASP VBScript

Status
Not open for further replies.

smeagolgollum

Programmer
Jun 19, 2003
9
FR
Hi

I am trying to use a class I wrote in VB in a ASP VBScript. I figured I could make the class a dll known to the system and then use the CreateObject to have an instance of it but it seems I missed something.

Can anyone help a bit ??
Thanks

Smeagol Gollum
 
Are you trying to do this on the client or the server??

I.e Client side script or Server Side Script?

 
I need to use the class I wrote with VB.NET on the server side scripts. There seems to be a problem when registering the assembly code to the .NET Framework even though Visual says everything is OK. I modified the code so that the class gets registered with COM but I never got it to work with ASP nor with another VB test module.
I am pasting the code so that you can tell me what I am missing. I am sorry for the amount of code I am posting. I trimmed it to the minimum.

Thanks in advance

File : LoggerClass.vb
Code:
<ComClass(Logger.ClassId, Logger.InterfaceId, Logger.EventsId)> _
Public Class Logger
#Region &quot;COM GUIDs&quot;
    ' These  GUIDs provide the COM identity for this class 
    ' and its COM interfaces. You can generate 
    ' these guids using guidgen.exe
    Public Const ClassId As String = &quot;6DEB3578-C952-4da5-BFF9-4A660A4B4449&quot;
    Public Const InterfaceId As String = &quot;9DA84E9E-DBA2-43a1-9AC6-8688D9DC1E42&quot;
    Public Const EventsId As String = &quot;5DCC5CB7-1BDC-4a5d-A112-933A00B1E37E&quot;

#End Region
    Public t As System.Random
    Public Sub New()
        MyBase.New()
    End Sub

    Public Function getdata() As String
        getdata = &quot;hehe&quot;
    End Function


End Class


File : Assembly.vb
Code:
Imports System.Reflection
Imports System.Runtime.InteropServices

' Les informations générales relatives à un assembly dépendent de l'ensemble 
' d'attributs suivant. Pour modifier les informations associées à un assembly, 
' changez les valeurs de ces attributs.

' Vérifiez les valeurs des attributs de l'assembly

<Assembly: AssemblyTitle(&quot;LoggerClass&quot;)> 
<Assembly: AssemblyDescription(&quot;Class used for logging program execution to a file&quot;)> 
<Assembly: AssemblyCompany(&quot;&quot;)> 
<Assembly: AssemblyProduct(&quot;&quot;)> 
<Assembly: AssemblyCopyright(&quot;&quot;)> 
<Assembly: AssemblyTrademark(&quot;&quot;)> 
<Assembly: CLSCompliant(True)> 
<Assembly: AssemblyKeyFileAttribute(&quot;key.snk&quot;)> 

'Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
<Assembly: Guid(&quot;33C0EDB1-7293-4708-A5F5-AA946B076557&quot;)> 

' Les informations de version pour un assembly se composent des quatre valeurs suivantes :
'
'      Version principale
'      Version secondaire 
'      Numéro de build
'      Révision
'
' Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut 
' en utilisant '*', comme indiqué ci-dessous :

<Assembly: AssemblyVersion(&quot;1.0.0.0&quot;)>

and the ASP File : index.asp
Code:
<%@ Language=&quot;VBScript&quot; %>

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//FR&quot;>
<html>
	<head>
		<title>Log Viewer Page</title>
		<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft Visual Studio .NET 7.0&quot;>
		<meta name=&quot;CODE_LANGUAGE&quot; content=&quot;Visual Basic 7.0&quot;>
		<meta name=&quot;vs_defaultClientScript&quot; content=&quot;JavaScript&quot;>
		<meta name=&quot;vs_targetSchema&quot; content=&quot;[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5&quot;>[/URL]
	</head>
	<body>
	<h4>This is a test for a log application</h4>
<% 
	Dim log
	Set log =  Server.CreateObject(&quot;LoggerClass.Logger&quot;)
	Response.Write(&quot;hehe&quot;)
%>
	</body>
</html>
the exact error I am getting is :

Technical Information (for support personnel)

Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: /testasp/index.asp, line 16


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)

Page:
GET /testasp/index.asp

Time:
Sunday, June 22, 2003, 8:25:02 PM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top