1

我正在尝试使用来自 Classic ASP 的 Amazon Route 53 服务器 API,但是当我发布请求时,HTTP 404 Not Found即使发送的 URL 是有效的,如果我将其粘贴到浏览器中,我也会收到错误消息。Classic ASP 不能调用 Route 53 还是我的代码有错误?

Dim linebreak, gmt, timestamp, urlparams, amazonserver, stringtosign, signature, signedURL, sha256
const versionDate="2009-07-01"
amazonserver="https://route53.amazonaws.com/2012-02-29/xxxxxxxxxx"
linebreak=chr(13)

const secretkey="my secret key"
gmt=DateAdd("H", 0, Now)

timestamp = return_RFC822_Date(Now(), "GMT")

set sha256=GetObject("script:"&Server.MapPath("sha256.wsc"))

stringtosign = timestamp

signature=sha256.b64_hmac_sha256(secretkey, stringtosign)

header = "AWS3-HTTPS AWSAccessKeyId=ky access id,Algorithm=HMANSHA256,Signature="&signature

Set sha256=nothing

signedURL=amazonserver&"/onca/xml?"&urlparams&"&Signature="&Server.URLEncode(signature)
response.write signedURL

Set xmlHttp = Server.Createobject("Microsoft.XMLHTTP")
xmlHttp.Open "POST", signedUrl, False
    response.write strURL&"<br>"
xmlHttp.setRequestHeader "User-Agent", "asp httprequest"
xmlHttp.setRequestHeader "Host", "route53.amazonaws.com"
xmlHttp.setRequestHeader "content-type", "text/plain"
    xmlHttp.setRequestHeader "X-Amzn-Authorization", signature
xmlHttp.Send()
    if xmlHttp.Status >= 400 And xmlHttp.Status <= 599 Then
        response.write "Error Occurred : " & xmlHttp.Status & " - " & xmlHttp.statusText
    else
        getXML = xmlHttp.responseText
    end if

xmlHttp.abort()
set xmlHttp = Nothing 
4

0 回答 0