I created a DLL that allows me to access a POP3 account with ASP. It works on my computer (WinXP Pro) using the LocalHost webserver. BUT when I put it on our Win2k Web Server I get a message saying "Can't Create Object".
I'm using the same ASP and DLL that works on my machine.
Is anyone familiar with how to resolve this?? Thanks =)
Andrew
Misc Info:
Server = Win2k Server w/ sp2
The Webserver is Set to allow Scripts & Executables
The NTFS Security is good
DLL IS Registered
Windows Script 5.6 Installed
IE6 Installed
-----[Begin Error Message]---------------------------------
ASPCONX error '800a01ad'
ActiveX component can't create object
/wap/test.asp, line 4
-----[END Error Message]-----------------------------------
Below is the Code
Project = AspConx
ClassModule = Mail
-----[Begin DLL]-------------------------------------------
Option Explicit
'Some code borrowed from WnsckFormDLL
Private WithEvents WSock As Winsock
Private Declare Function GetTickCount Lib "kernel32" () As Long
Dim output, Username1, Password1, Site1 As String
Private Sub Class_Initialize()
Set WSock = New Winsock
End Sub
Private Sub Class_Terminate()
If WSock.State = 7 Then WSock.Close
Do
Pause (500)
Loop While WSock.State = 7
Set WSock = Nothing
End Sub
Public Function GetMyMail(Username As String, Optional Password _
As String, Optional Site As String, Optional Port As String)
output = "User: " & Username & vbCrLf
Username1 = Username
Password1 = Password
Site1 = Site
With WSock
If .State <> 0 Then
.Close
Do
Loop Until .State = 0
End If
.RemoteHost = Site
.RemotePort = Port
.Connect
Do
Pause (500)
Loop Until .State > 6
Select Case .State
Case 9
output = output & "Error Connecting To Server - Case 9<br>"
Case 8
output = output & "Error Connecting To Server - Case 8<br>"
Case 7
output = output & "Connected To Server!" & vbCrLf
ReadLine
Login
GetLast
.SendData "Quit" & vbCrLf
Pause (500)
End Select
End With
GetMyMail = "<textarea name=""txtarea"" rows=""25"" cols=""80"">" _
& output & "</textarea><br>"
End Function
Private Sub ReadLine()
Dim InData As String
Dim intTimeOut As Integer
intTimeOut = 0
InData = ""
Do
intTimeOut = intTimeOut + 1
WSock.GetData InData
If intTimeOut > 12 And InData = "" Then InData = _
"ERROR - Timeout Occured After " & intTimeOut / 2 & " Seconds."
If InData = "" Then Pause (500)
Loop While InData = ""
output = output & InData & vbCrLf
End Sub
Private Sub Login()
WSock.SendData "USER " & Username1 & vbCrLf
output = output & "USER " & Username1 & vbCrLf
ReadLine
WSock.SendData "PASS " & Password1 & vbCrLf
output = output & "PASS " & Password1 & vbCrLf
ReadLine
End Sub
Private Sub GetLast()
Dim InData As String
Dim intTimeOut As Integer
Dim strLastMsg As String
Dim intLastMsg As Integer
WSock.SendData "LAST" & vbCrLf
intTimeOut = 0
InData = ""
Do
intTimeOut = intTimeOut + 1
WSock.GetData InData
If intTimeOut > 12 And InData = "" Then InData = _
"ERROR - Timeout Occured After " & intTimeOut / 2 & " Seconds."
If InData = "" Then Pause (500)
Loop While InData = ""
strLastMsg = Mid$(InData, 4)
intLastMsg = CInt(strLastMsg)
intLastMsg = intLastMsg + 1
output = output & "Getting Message " & intLastMsg & vbCrLf
WSock.SendData "RETR " & intLastMsg & vbCrLf
ReadLine
End Sub
Private Sub Pause(Interval As Long)
Dim Start
Start = GetTickCount
Do While GetTickCount < Start + Interval
DoEvents
Loop
End Sub
-----[End DLL]---------------------------------------------
-----[Begin ASP]-------------------------------------------
Line 01: <html><body>
Line 02: <%
Line 03: dim strOutput, objMailDll
Line 04: set objMailDll = Server.CreateObject("AspConx.Mail"
Line 05:
Line 06: strOutput = objMailDll.GetMyMail("UserName", "Password", "MailAddr.com", "110"
Line 07:
Line 08: response.Write strOutput & "<br>"
Line 09: set objMailDll = Nothing
Line 10: %>
-----[End ASP]---------------------------------------------
I'm using the same ASP and DLL that works on my machine.
Is anyone familiar with how to resolve this?? Thanks =)
Andrew
Misc Info:
Server = Win2k Server w/ sp2
The Webserver is Set to allow Scripts & Executables
The NTFS Security is good
DLL IS Registered
Windows Script 5.6 Installed
IE6 Installed
-----[Begin Error Message]---------------------------------
ASPCONX error '800a01ad'
ActiveX component can't create object
/wap/test.asp, line 4
-----[END Error Message]-----------------------------------
Below is the Code
Project = AspConx
ClassModule = Mail
-----[Begin DLL]-------------------------------------------
Option Explicit
'Some code borrowed from WnsckFormDLL
Private WithEvents WSock As Winsock
Private Declare Function GetTickCount Lib "kernel32" () As Long
Dim output, Username1, Password1, Site1 As String
Private Sub Class_Initialize()
Set WSock = New Winsock
End Sub
Private Sub Class_Terminate()
If WSock.State = 7 Then WSock.Close
Do
Pause (500)
Loop While WSock.State = 7
Set WSock = Nothing
End Sub
Public Function GetMyMail(Username As String, Optional Password _
As String, Optional Site As String, Optional Port As String)
output = "User: " & Username & vbCrLf
Username1 = Username
Password1 = Password
Site1 = Site
With WSock
If .State <> 0 Then
.Close
Do
Loop Until .State = 0
End If
.RemoteHost = Site
.RemotePort = Port
.Connect
Do
Pause (500)
Loop Until .State > 6
Select Case .State
Case 9
output = output & "Error Connecting To Server - Case 9<br>"
Case 8
output = output & "Error Connecting To Server - Case 8<br>"
Case 7
output = output & "Connected To Server!" & vbCrLf
ReadLine
Login
GetLast
.SendData "Quit" & vbCrLf
Pause (500)
End Select
End With
GetMyMail = "<textarea name=""txtarea"" rows=""25"" cols=""80"">" _
& output & "</textarea><br>"
End Function
Private Sub ReadLine()
Dim InData As String
Dim intTimeOut As Integer
intTimeOut = 0
InData = ""
Do
intTimeOut = intTimeOut + 1
WSock.GetData InData
If intTimeOut > 12 And InData = "" Then InData = _
"ERROR - Timeout Occured After " & intTimeOut / 2 & " Seconds."
If InData = "" Then Pause (500)
Loop While InData = ""
output = output & InData & vbCrLf
End Sub
Private Sub Login()
WSock.SendData "USER " & Username1 & vbCrLf
output = output & "USER " & Username1 & vbCrLf
ReadLine
WSock.SendData "PASS " & Password1 & vbCrLf
output = output & "PASS " & Password1 & vbCrLf
ReadLine
End Sub
Private Sub GetLast()
Dim InData As String
Dim intTimeOut As Integer
Dim strLastMsg As String
Dim intLastMsg As Integer
WSock.SendData "LAST" & vbCrLf
intTimeOut = 0
InData = ""
Do
intTimeOut = intTimeOut + 1
WSock.GetData InData
If intTimeOut > 12 And InData = "" Then InData = _
"ERROR - Timeout Occured After " & intTimeOut / 2 & " Seconds."
If InData = "" Then Pause (500)
Loop While InData = ""
strLastMsg = Mid$(InData, 4)
intLastMsg = CInt(strLastMsg)
intLastMsg = intLastMsg + 1
output = output & "Getting Message " & intLastMsg & vbCrLf
WSock.SendData "RETR " & intLastMsg & vbCrLf
ReadLine
End Sub
Private Sub Pause(Interval As Long)
Dim Start
Start = GetTickCount
Do While GetTickCount < Start + Interval
DoEvents
Loop
End Sub
-----[End DLL]---------------------------------------------
-----[Begin ASP]-------------------------------------------
Line 01: <html><body>
Line 02: <%
Line 03: dim strOutput, objMailDll
Line 04: set objMailDll = Server.CreateObject("AspConx.Mail"
Line 05:
Line 06: strOutput = objMailDll.GetMyMail("UserName", "Password", "MailAddr.com", "110"
Line 07:
Line 08: response.Write strOutput & "<br>"
Line 09: set objMailDll = Nothing
Line 10: %>
-----[End ASP]---------------------------------------------