收到“Microsoft VBScript 运行时错误“800a01a8””

发布于 2024-11-09 01:45:47 字数 1367 浏览 0 评论 0原文

我继承了一个网站来进行一般维护。网页是 ASP 页面,但我的大部分工作都是使用 html/css。该网站多年来一直运行良好,直到现在。当我尝试加载包含 VB 脚本的页面时,收到以下错误:

Microsoft VBScript 运行时错误“800a01a8”

所需对象:“[对象]”

/new_products.asp,第 12 行

asp 页面的名称根据正在调用的页面而变化,但行引用是相同的。

生成错误的代码如下:

        Dim objXMLHTTP
    Dim coordinates
    Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    ip = Request.ServerVariables("REMOTE_ADDR")
    objXMLHTTP.Open "GET", "http://www.ippages.com/xml/?ip="&ip&"&get=country", False
    objXMLHTTP.Send
    Set xmldoc = objXMLHTTP.responseXML
    country = xmldoc.selectSingleNode("ip_address/lookups/lookup_country").text
    set objXMLHTTP=nothing

    theCountry = Trim(UCASE(country))


    If theCountry = "CA-CANADA" then
        Bags = "13.99"
        SB4Pack = "14.00"
        currency_code = "CAD"
        lc = "CA"
        Pref = "$"
        ShipType = 1
    ElseIf theCountry = "US-UNITED STATES" then
        Bags = "13.99"
        SB4Pack = "14.00"
        currency_code = "USD"
        lc = "US"
        Pref = "$"
        ShipType = 2
    Else
        Bags = "8.00"
        SB4Pack = "11.00"
        currency_code = "GBP"
        lc = "UK"
        Pref = "£"
        ShipType = 2
    End If

由于我对 VB 的了解极其有限,我已尽最大努力尝试找出代码停止工作的原因,但我被难住了。非常感谢任何和所有的帮助。

I had inherited a website to do general maintenance on. The web pages are ASP pages but the bulk of my work has been with the html/css. The site has been working fine for a number of years, that is until now. When I try to load pages that are containing VB script I receive the following error:

Microsoft VBScript runtime error '800a01a8'

Object required: '[object]'

/new_products.asp, line 12

the name of the asp page changes based on the page that is being called, but the line reference is the same.

The code that is generating the error is as follows:

        Dim objXMLHTTP
    Dim coordinates
    Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    ip = Request.ServerVariables("REMOTE_ADDR")
    objXMLHTTP.Open "GET", "http://www.ippages.com/xml/?ip="&ip&"&get=country", False
    objXMLHTTP.Send
    Set xmldoc = objXMLHTTP.responseXML
    country = xmldoc.selectSingleNode("ip_address/lookups/lookup_country").text
    set objXMLHTTP=nothing

    theCountry = Trim(UCASE(country))


    If theCountry = "CA-CANADA" then
        Bags = "13.99"
        SB4Pack = "14.00"
        currency_code = "CAD"
        lc = "CA"
        Pref = "$"
        ShipType = 1
    ElseIf theCountry = "US-UNITED STATES" then
        Bags = "13.99"
        SB4Pack = "14.00"
        currency_code = "USD"
        lc = "US"
        Pref = "$"
        ShipType = 2
    Else
        Bags = "8.00"
        SB4Pack = "11.00"
        currency_code = "GBP"
        lc = "UK"
        Pref = "£"
        ShipType = 2
    End If

With my extremely limited knowledge of VB I have done my best to try and figure out why the code has stopped working, but I am stumped. Any and all help is greatly greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮生面具三千个 2024-11-16 01:45:47

由于这是一个环境特定问题,正如您提到的,最近开始出现......无法提供确定的声明。你需要调查一下。一个人能做的就是提出一些建议。我相信你的问题就是这个陈述之一。

Set xmldoc = objXMLHTTP.responseXML
country = xmldoc.selectSingleNode("ip_address/lookups/lookup_country").text

可能这个值不会出现,或者为 Null 或 Nothing。如果它为 Null、Nothing,请尝试打印国家/地区的值...稍后,当您尝试更改国家/地区的大小写时...您可以使用工具来捕获 Http请求和响应工具(例如 Fidler)可验证 Lookup_country 中的值或您是否正在获取此节点。

还声明了 theCountry 。如果它是动态变量,那么检查是否有人启用了 OptionExplicit?

Since this is an environment specific issue which started to popup recently as you mentioned... No sure statement can be provided. You need to investigate it. What one can do is to suggest some thing. I believe your problem is one of this statement.

Set xmldoc = objXMLHTTP.responseXML
country = xmldoc.selectSingleNode("ip_address/lookups/lookup_country").text

Probably this value is not coming or Null or Nothing.Try to print the value of country if it's coming as Null, Nothing... Later when you try to change the case of country.... You can use tools to capture the Http request and response tools like Fidler to verify what is coming in lookup_country as a value or whether you are getting this node or not.

Also where is theCountry is declared. If it's dynamic variable then check if some one enabled OptionExplicit??

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文