If I host video or any other media content on Amazon S3, how can I use ASP.net Membership to enforce access rights?
Asked
Active
Viewed 480 times
1 Answers
3
S3 permissions
Make sure that you don't grant anonymous read access to your S3 content.
Asp.net security
Setup your asp.net pages so that only logged in users or those with appropriate permissions can visit them
Urls to S3 content
On your Asp.net pages, generate time limited urls to your content on S3. eg Using the AWS SDK for .net to create a pre-signed url in vb.net:
Dim AWSKey As String = "AWS_Key"
Dim AWSSecretKey As String = "AWS_SecretKey"
Using client As AmazonS3 = Amazon.AWSClientFactory.CreateAmazonS3Client(AWSKey, AWSSecretKey)
Dim req = New Model.GetPreSignedUrlRequest With { _
.BucketName = bucket, _
.Key = key, _
.Protocol = Model.Protocol.HTTPS, _
.Verb = Model.HttpVerb.GET, _
.Expires = Now.AddDays(ExpiryInDays).AddSeconds(secs) }
Dim url As String = client.GetPreSignedURL(req)
End Using

Geoff Appleford
- 18,538
- 4
- 62
- 85
-
Thanks dear, will need to do some work on how to generate time-limited urls. If you know any please give me links. – TheVillageIdiot Dec 17 '10 at 09:26
-
@TheVillageIdiot - Download the AWS SDK for dotnet at http://aws.amazon.com/sdkfornet/. It has example code on how to do this and easy to use libraries to do just that. I'll update my answer shortly with a sample – Geoff Appleford Dec 17 '10 at 09:28