Link to home
Start Free TrialLog in
Avatar of hayri
hayri

asked on

Registering a COM component

I have been trying to develop COM components. When I use regsvr32 at the server it says registration is succeded. But when I use the component in asp pages I get the "object required" message in err object

Any idea??

ps: I have been doing ASP development last 2 years. But I am new to VB component development..
Avatar of alaplume
alaplume

Well, could you provide some code, it's probably a bug.

I would imagine it looks something like this:

dim o as object

set o = createobject("ComponentName.ClassName",[ServerName])
Avatar of hayri

ASKER

This activeX DLL should return custom error messages for IIS 404 and 500. To do that I have created a file named 404.asp and placed it in root directory of the webserver and I also pointed the Default error messages to this file for error # 404 and 500 on the web server.
The 404.asp file contents
<%
set track=server.createobject("myErr.track404")
track.log()   'this supposed put the data in a SQL table regarding the error
set track=nothing

%>

THE ENTIRE CODE FOR THE ACTIVE X:

  Public objConnection As ADODB.Connection

  Public strReferrer As String
  Public strQueryString As String
  Public strServerName As String
  Public strIPAddress As String
  Public strBrowser As String
  Public strSQL As String
  Public strNow As String

  Public vntServerName As Variant

  Public boolValid As Boolean

  Public objContext As ObjectContext
  Public objRequest As ASPTypeLibrary.Request

  Public Function getSV(ByVal str As String) As String
    getSV = Replace(objRequest.ServerVariables(str), "'", "''")
  End Function

  Public Function log() As Long
    Set objContext = GetObjectContext()
    Set objRequest = objContext("Request")
    strQueryString = LCase(getSV("query_string"))
    strServerName = LCase(getSV("server_name"))
    strReferrer = LCase(getSV("http_referer"))
    strIPAddress = getSV("remote_addr")
    strBrowser = getSV("http_user_agent")
    strNow = FormatDateTime(Now(), vbShortDate) & " "
    strNow = strNow & FormatDateTime(Now(), vbShortTime)
    boolValid = False
    If Len(strQueryString) > 4 Then
      If Left(strQueryString, 4) = "404;" Or Left(strQueryString, 4) = "500;" Then
        If InStr(strQueryString, "favicon.ico") <= 0 Then
          strQueryString = Right(strQueryString, Len(strQueryString) - 4)
          boolValid = True
          If InStr(strQueryString, strServerName) > 0 Then
            vntServerName = Split(strQueryString, strServerName)
            strQueryString = vntServerName(1)
          End If
        End If
      End If
    End If
    Set objRequest = Nothing
    Set objContext = Nothing
    If boolValid Then
      strSQL = "exec STrack404"
      strSQL = strSQL & "  @ip  ='" & strIPAddress & "'"
      strSQL = strSQL & ", @url ='" & strQueryString & "'"
      strSQL = strSQL & ", @ref ='" & strReferrer & "'"
      strSQL = strSQL & ", @dt  ='" & strNow & "'"
      strSQL = strSQL & ", @ua  ='" & strBrowser & "'"
      Set objConnection = CreateObject("adodb.connection")
      objConnection.Open "driver={SQL Server};server=myIPAddress;database=myDatabase;uid=myID;pwd=myPsw"
      objConnection.Execute (strSQL)
      objConnection.Close
      Set objConnection = Nothing
    End If
  End Function
Avatar of DanRollins
Hi hayri,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

hayri, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
ASKER CERTIFIED SOLUTION
Avatar of RotaredoM
RotaredoM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial