Load image from external domain (AWS S3) and store it in browser memory
<p>I'm new to ASP.net and wondered how easy it is to load a photo from an external domain (Amazon S3), using their expiring link, and store the photo in browser memory for another script to pick up that uses an OpenBinary method? This allows me to resize and watermark it before printing to screen.</p>

<p>This is what I want to happen:</p>

<p></p>

<p>On loadImage.aspx, I get the photoID from my DB, create an expiring signed URL for Amazon S3, call the photo somehow and save it to memory. When in memory, my ASP.Jpeg script will call the OpenBinary method, resize and watermark the photo and the use the SendBinary method to show the photo.</p>

<p>I think memory stream or response binary write maybe the thing I'm looking for but not sure how to use it on an external photo source. This is what I have managed so far but got confused and thought I'd get help as I'm not sure this is going to work, if I can load an external domains photo in memory, if I'm missing something important....</p>

<p><strong>My image element:</strong></p>

<pre><code>&lt;img src="loadImage.aspx?p=234dfsdfw5234234"&gt;
</code></pre>

<p><strong>On loadImage.aspx:</strong></p>

<pre><code>string AWS_filePath = "http://amazon............"

using (FileStream fileStream = File.OpenRead(AWS_filePath))
{
    MemoryStream memStream = new MemoryStream();
    memStream.SetLength(fileStream.Length);
    fileStream.Read(memStream.GetBuffer(), 0, (int)fileStream.Length);
}

// Persits ASP.Jpeg Component

objJpeg.OpenBinary( ... );
// resize bits
// watermark bits
objJpeg.SendBinary( ... );
</code></pre>

<p>Any help would be amazing.</p>
