Make sure to use Unix path separator while working with AWS .Net SDK

Ran into the following signature mismatch exception while trying to upload a file into a folder on using using AWS .Net  SDK.

“Amazon.S3.AmazonS3Exception : The request signature we calculated does not match the signature you provided. Check your key and signing method.”

Uploading files in the root of the bucket worked fine, but, the signature calculated by the SDK didn’t match the server calculated signature while trying to upload to a folder.  The problem turned out to be the path separator, AWS include object key while calculating request signature, but, the server is using ‘/’ as path separator, while the SDK uses whatever you set. Since most the .Net functions use ‘\’ to separate paths make sure to replace the separator while creating the request.

image

Using Unix style path separator fixed the problem.

image

Advertisements

One thought on “Make sure to use Unix path separator while working with AWS .Net SDK

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s