I set "cloud web site", "SQL DB", "BLOB"... onto azure.
Here is the thing I want to do:
Get image from BLOB(azure) through ashx file and show out the image in web page (element:image).
It can't find any photo and show error:
Error code>>>
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
ashx code>>>
CloudStorageAccount storage = CloudStorageAccount.Parse(string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", storageName, storageKey));
CloudBlobClient cloudBlobClient = storage.CreateCloudBlobClient();
CloudBlobContainer container = cloudBlobClient.GetContainerReference("memid" + MemID);
container.CreateIfNotExist();
CloudBlob obj = container.GetBlobReference(PhotoHash);
BlobStream blobstream = obj.OpenRead();
Image img = null;
img = Image.FromStream(blobstream, true);
context.Response.ContentType = "image/jpeg";
var byteArray = obj.DownloadByteArray();
context.Response.OutputStream.Write(byteArray, 0, byteArray.Length);
aspx code>>>
var PldImg = $('<img></img>')
.attr('src', 'LoadFriendsPhoto/LoadPhotoFromBlob.ashx?MemID=' + MemID + '&PathNameData=' + friInfo[i - 1].PhotoHash);
p.s PhotoHash is the BLOB file name, example: 004dae3947219415f5899b2d6bbe9637
How can I fix this?
Thanks.