我正在尝试使用经典 ASP 将文件上传到 Azure Blob 存储(别无选择!)。但是,尽管我可以使用 MSXML2.ServerXMLHTTP 列出容器内容,但我无法创建 blob。我需要用它来上传 PDF 文件,所以我使用 BlockBlob。
我相信我无法正确创建授权密钥。有没有人有在经典 ASP VBScript 中创建授权密钥的代码示例?我有类似下面的内容,但不知道如何在 Classic ASP 中生成密钥。
' replace with your account's settings
' setup the URL
baseUrl = "https://<myaccount>.blob.core.windows.net"
Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
PathUrl = baseUrl & "/test/myblob"
' setup the request and authorization
http.open "PUT", PathUrl , false
'How do I generate this key from the headers and path using HMAC-SHA256 and my prim/sec account key
http.setRequestHeader "Authorization", "SharedKey <myaccount>:?????"
http.setRequestHeader "Date", "2011-6-16 9:22"
http.setRequestHeader "x-ms-date", "2011-06-16 9:22"
http.setRequestHeader "x-ms-version", "2009-09-19"
http.setRequestHeader "Content-Length", "11"
http.setRequestHeader "x-ms-blob-type","BlockBlob"
http.setRequestHeader "Content-Type", "text/plain; charset=UTF-8"
postData = "hello world"
' send the POST data
http.send postData
' optionally write out the response if you need to check if it worked
Response.Write http.responseText
我收到错误 AuthenticationFailedServer 无法对请求进行身份验证。确保 Authorization 标头的值正确形成,包括签名。
谢谢
格雷姆