Hello Olav,
In this scenario, your implementation would be similar to what I discussed
below...
The differences: When you get your data from the web service, loop through
your images and add each to the Cache.
HttpContext.Current.Cache.Add(key, value....);
Then in your getphoto.aspx file do what I detailed below changing the
first line to be:
byte[] buffer =
(byte[])HttpContext.Current.Cache[Request.QueryString[key]];
Of course, I have no error checking in there. I'll leave it up to you to
implement checking whether or not there actually is an item in the cache.
Hope this leads you down the right direction... If not, please feel free
to post a follow-up...
--
Matt Berther
http://www.mattberther.com
I have seen applications doing something like this:
getphoto.aspx?key=B59273C3BB30A9AD7AD5
Instead of using the web service to transfer the byte array back to
the client, it generates a URL with a uniqueue key and feed that back
to the client. Then the image is fetche as you suggested dynamically
when the browser requests the URL. In addition, the key expires after
a while to keep access control to the server.
How do you implement something like this? Is it easily supported by
the .NET framework or do I have to do a lot of hand-coding for this
scenario?
Olav
Hello Olav,
An image is going to constitue another request, so what you'll need
do is assign the Image URL to a page or handler in your website.
This page/handler will have code something like this:
byte[] buffer = someMethodToGetTheByteArray();
Response.ContentType = "image/jpeg";
Response.BinaryWrite(buffer);
Response.End();
--
Matt Berther
http://www.mattberther.com
I'm getting an array of bytes returned from a web service
representing a jpeg image. How can I display this on an asp.net
page? The Image control seems only to take an URL as a paremeter.
Olav