FineUploader与Amazon S3网络错误403禁止

时间:2015-10-31 18:30:55

标签: amazon-s3 cors

我正在尝试使用Amazon S3的FineUploader,但仍然收到以下错误:

“NetworkError:403 Forbidden - https://qmusai.s3.amazonaws.com/orgnl/” 同源策略不允许在

中读取远程资源

我正在使用ASP.NET MVC,这是我的策略编码和签名mvc操作:

   [HttpPost]
public ActionResult Signature()
{
    Stream req = Request.InputStream;
    req.Seek(0, System.IO.SeekOrigin.Begin);
    string policyStr = new StreamReader(req).ReadToEnd();

    string b64Policy = Convert.ToBase64String(Encoding.ASCII.GetBytes(policyStr));

    byte[] b64Key = Encoding.ASCII.GetBytes("PSaIT1EaZImMRtwKjWlMJCuR+9lu8qArYr/Ju6MP");
    HMACSHA1 hmacSha1 = new HMACSHA1(b64Key);

    var signatureEncoded = Convert.ToBase64String(hmacSha1.ComputeHash(Encoding.ASCII.GetBytes(b64Policy)));

    return Json(new { policy = b64Policy, signature = signatureEncoded });


}

0 个答案:

没有答案