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 "COM GUIDs"
' 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 = "6DEB3578-C952-4da5-BFF9-4A660A4B4449"
Public Const InterfaceId As String = "9DA84E9E-DBA2-43a1-9AC6-8688D9DC1E42"
Public Const EventsId As String = "5DCC5CB7-1BDC-4a5d-A112-933A00B1E37E"
#End Region
Public t As System.Random
Public Sub New()
MyBase.New()
End Sub
Public Function getdata() As String
getdata = "hehe"
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("LoggerClass")>
<Assembly: AssemblyDescription("Class used for logging program execution to a file")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
<Assembly: AssemblyKeyFileAttribute("key.snk")>
'Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
<Assembly: Guid("33C0EDB1-7293-4708-A5F5-AA946B076557")>
' 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("1.0.0.0")>
and the ASP File : index.asp
Code:
<%@ Language="VBScript" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//FR">
<html>
<head>
<title>Log Viewer Page</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5">[/URL]
</head>
<body>
<h4>This is a test for a log application</h4>
<%
Dim log
Set log = Server.CreateObject("LoggerClass.Logger")
Response.Write("hehe")
%>
</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