I'm currently using a WCF web service to return images based on an id:
[WebGet(UriTemplate = "Images/{ID}/{size}.jpg")]
Stream GetImage (string ID, string size)
{
... Logic to determine image to return ...
}
If the given ID doesn't exist in the DB, then I return a placeholder image. This placeholder image is always the same.
Is there anyway to inform the client that the image is the same and to cache it, even though the url used to access it is different? It's possible that there could be 30 or more of these placeholder images, so loading the same image 30 times doesn't really make sense.
EDIT:
The answer below works really well. My code looks like this:
{
WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Redirect;
WebOperationContext.Current.OutgoingResponse.Location = "//myImageLoc/defaultImg.jpg";
fileStream = null;
}
This works for img tags and for AFNetworking+UIKit images in iOS.