I use Amazon S3 to host user images. Although I have determined that they are all publicly available (this means that I can access images at my URLs in Chrome / Firefox / IE), I get a Forbidden 403 exception in my code. This is 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()
This is very strange for me, if something is wrong with the ACL or permissions, why do I see images with a browser? Any help would be greatly appreciated.
source share