samedi 11 avril 2015

ASP FORM POST Confliting query string acl,policy

I need a little help with a form in ASP .NET C# – it's a standard web application.


The form is used to upload file to Amazon S3 through Cloudfront



<form name="form" action="http://ift.tt/1FF8cdd" method="post" enctype="multipart/form-data">


I tryed to use the HTML submit button inside the form, but it just reloads the page.



<input type="submit" name="submit" value="Upload to Amazon S3" />


So I used a ASP button with PostBackUrl to Cloudfront.



<asp:Button ID="Button1" runat="server" Text="Upload to Amazon" PostBackUrl="http://ift.tt/1FF8cdd" />


When I submit with the ASP button, the cloudfront xml returns an error:



Conflicting query string parameters: acl, policy


I didn't find anything useful on the internet about it.


This same form works just fine in PHP.


This is the form structure:



<form name="form" action="http://ift.tt/1FF8cdd" method="post" enctype="multipart/form-data">
Key to upload:
<input type="input" name="key" value="Test/${filename}" /><br />
<input type="hidden" name="acl" value="public-read" />
<input type="hidden" name="success_action_redirect"
value="http://ift.tt/1IyiJKW"/>
content-type:
<input type="input" name="content-type" value="binary/octet-stream" /><br />
<input type="hidden" name="x-amz-meta-uuid" value="14365123651274" />
<input type="text" name="x-amz-credential"
value="AKIAEXAMPLE/20150415/eu-west1/s3/aws4_request" />
<input type="text" name="x-amz-algorithm" value="AWS4-HMAC-SHA256" />
<input type="text" name="x-amz-date" value="20150415T000000Z" />

Tags for File:
<input type="input" name="x-amz-meta-tag" value="" /><br />
<input type="hidden" name="policy" value="<The policy encoded in Base 64>" />
<input type="hidden" name="x-amz-signature" value="<The encoded signature>" />
File:
<input type="file" name="file" /> <br /></form>


And this the policy:



{ "expiration": "2015-04-15T12:00:00.000Z",
"conditions": [
{"bucket": "mybucket"},
["starts-with", "$key", "Test/"],
{"acl": "public-read"},
{"success_action_redirect": "http://ift.tt/1IyiJKW"},
["starts-with", "$Content-Type", "binary/"],
{"x-amz-meta-uuid": "14365123651274"},
["starts-with", "$x-amz-meta-tag", ""],
{"x-amz-credential": "AKIAEXAMPLE/20150415/eu-west-1/s3/aws4_request"},
{"x-amz-algorithm": "AWS4-HMAC-SHA256"},
{"x-amz-date": "20150415T000000Z" }
]
}

Aucun commentaire:

Enregistrer un commentaire