I'm finding that setting the RequestCachePolicy
property on BitmapImage
has no effect on how the bitmap is downloaded when an Image
's Source
is set to this instance of BitmapImage
.
For example, if I set the RequestCachePolicy
to CacheOnly
, I would expect no internet traffic to occur whatsoever - the specified image should only be retrieved from the cache. But instead, I see a request being made to the server to download an image:
source = new BitmapImage(bmi.UriSource,
new RequestCachePolicy(RequestCacheLevel.CacheOnly));
// An image gets downloaded!
If I set the static DefaultCachePolicy
property on HttpWebRequest
, then my application behaviour changes in a way I would expect. ie when it's set to CacheOnly
, no network traffic occurs.
Why is the RequestCachePolicy
property on BitmapImage
not having the effect I expect?
According to the MSDN site: http://msdn.microsoft.com/en-us/library/system.net.cache.requestcachepolicy%28v=vs.110%29.aspx
"Caching for Web services is not supported."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With