HTTP Status 443 on Server.CreateObject in VBScript

2019-08-15 21:13发布

问题:

This is old legacy code that has been running at least 5 years. The DLL happens to relate to Paypal's PayFlowPro merchant processing service, but I think this is a Windows scenario causing the issue.

Suddenly, based on the code below, I'm seeing this error in the browser:

> Error with new credit card processing software, please call Neal at xxx-xxx-xxxx
> Error Ref102: client = Server.CreateObject returned Null
> (Detailed error: Object doesn't support this property or method)
> (Detailed error: 438)

The IIS log shows me the 443:

2013-12-19 00:57:24 W3SVC4 173.45.87.10 POST /myapps/adm_settle.asp - 443 - 76.187.77.159 Mozilla/5.0+(Windows+NT+6.2;+WOW64;+rv:26.0)+Gecko/20100101+Firefox/26.0 200 0 0

Since I saw the 433 above, I'm thinking there must be some security error. Just as a test, I tried putting the app-pool user in the Administrator group, restarted IIS, and still get exact same error. I have also given that user specific access to read the .DLL on disk.

I did run REGASM to try to re-register the .DLL. I also tried REGSRV32, but I guess that fails on .NET DLLs. It's been a few years since I've dealt with software this old.

The ASP/VBScript Code:

    Err.Clear 
    On Error Resume Next 
    set client = Server.CreateObject("PayPal.Payments.Communication.PayflowNETAPI")
    If Err.number > 0 Then 
       response.write "Error with new credit card processing software, please call Neal at xxx-xxx-xxxx" 
       response.write "</br>(Detailed error: " & Err.Description & ")" 
       response.write "</br>(Detailed error: " & Err.Number & ")" 
       response.End 
    End If 
    If client Is Nothing Then 
       Response.write "Error with new credit card processing software, please call Neal at xxx-xxx-xxxx" 
       Response.Write "</br>Error Ref101: client = Server.CreateObject returned 'nothing' "
       response.write "</br>(Detailed error: " & Err.Description & ")" 
       response.write "</br>(Detailed error: " & Err.Number & ")" 
       Response.End 
    End If 
    If client = null Then 
       Response.write "Error with new credit card processing software, please call Neal at xxx-xxx-xxxx" 
       Response.Write "</br>Error Ref102: client = Server.CreateObject returned Null "
       response.write "</br>(Detailed error: " & Err.Description & ")" 
       response.write "</br>(Detailed error: " & Err.Number & ")" 
       Response.End 
    End If 

Also, I'm not sure how the 443 http status gets changed to a 438 Err.Number.

回答1:

Thanks everyone. I wish I had saved my original error. I've been doing C# so long, I was forgetting how to code VBScript. I tried to add error handling which may have been giving me false results.

If some of the guys who had commented would have put answers, I would have accepted them.

The 443 was another false trail and bad assumption on my part that it was an error, not a port #.

Unfortunately now, I didn't save the original error. I had added code to my original code to give supposedly better or tighter error handling, and adding the "= null" test was a bad idea.

This was a pretty good explanation of VBScript's use of empty vs nothing vs isNull: http://evolt.org/node/346/

I removed that, and the corrected code is:

    Err.Clear 
    On Error Resume Next 
    'set client = Server.CreateObject("PFProCOMControl.PFProCOMControl.1")
    set client = Server.CreateObject("PayPal.Payments.Communication.PayflowNETAPI")
    If Err.number > 0 Then 
       response.write "Error with new credit card processing software, please call Neal at 214-455-8060" 
       response.write "</br>(Detailed error: " & Err.Description & ")" 
       response.write "</br>(Detailed error: " & Err.Number & ")" 
       response.End 
    End If 
    If client Is Nothing Then 
       Response.write "Error with new credit card processing software, please call Neal at 214-455-8060" 
       Response.Write "</br>Error Ref101: client = Server.CreateObject returned 'nothing' "
       response.write "</br>(Detailed error: " & Err.Description & ")" 
       response.write "</br>(Detailed error: " & Err.Number & ")" 
       Response.End 
    End If