I'm using Amazon S3 for hosting images of users. Although I set all of them to be available for public (it means I could access images by their URLs in Chrome/Firefox/IE), I get a 403 Forbidden exception in my code. It's a thumbnail handler (C#, ASP.NET)
string file = context.Request.QueryString[IMG_PARAM].Trim().ToLower().Replace("\\", "/");
if (file.StartsWith("http") || file.StartsWith("https"))
{
using (System.Drawing.Image im = System.Drawing.Image.FromStream(WebRequest.Create(file).GetResponse().GetResponseStream()))
using (System.Drawing.Image tn = this.CreateThumbnail(im))
{
tn.Save(context.Response.OutputStream, this._formatType);
}
}
The exception comes from this part:
WebRequest.Create(file).GetResponse().GetResponseStream()
It's really strange to me, If there's something wrong with ACL or permissions, why I can see images with browser?