从Amazon Route 53的有效URL返回404错误

时间:2012-10-08 12:35:53

标签: asp-classic amazon-web-services amazon-route53

我正在尝试使用来自Classic ASP的Amazon的Route 53服务器API,但是当我发布请求时,如果我将其粘贴到浏览器中,则即使发送的URL有效,我也会收到HTTP 404 Not Found错误。经典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 

0 个答案:

没有答案