0
votes

I'm really not very familiar with ASP, but the site I'm managing is spitting that error out to me. Here is the full code from the site:

Microsoft VBScript runtime error '800a0009' Subscript out of range: '[number: 1]' /shopping_sub.asp, line 715.

Here is the code from 697-728:

'Response.write strPass & "<p>"     
    'Response.write "Response: " & strResp
    'Response.end

    If strResp="ERROR" then
        RESULT_num_shipping_options = -1
        Session("ShipErrMsg")="To continue your order, please contact customer service regarding your contact information. Thank you."
    Else    
        RESULT_num_shipping_options=1

        vResp=Split(strResp,":")

        Dim RESULT_shipping_description_array(4)
        Dim RESULT_shipping_amount_array(4)

        For I = 0 to UBound(vResp)
                vResp2=Split(vResp(I),"|")
                RESULT_shipping_description_array(I)=vResp2(0)
                RESULT_shipping_amount_array(I)=vResp2(1)

        Next            
    End If      

Else
    RESULT_num_shipping_options = -1
    cShipping=0
End If
End If

'Response.write "Weight: " & siWeight & "<br/>"
'Response.write "Zip: " & receiverpostalcode & "<br/>"
'Response.write "Country: " & receivercountrycode & "<br/>"

It appears to start functioning after 7 items have been added to the cart, but anything less than that returns errors.

This doesn't happen with all products, so any idea?

1

1 Answers

1
votes

Have you used a debugger to determine the value of vResp and the array length of vResp2?

My guess is that the response is not what you expected. If you can't force the api to always have the correct response, then you'll want to protect against it by checking the length of the split response before trying to access the value.

Another problem I see that is unrelated, is that if the UBound(vResp)_ > 4, then you'll get a similar error