Why does BitmapImage RequestCachePolicy get ignored?
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 Bitmap开发者_如何学编程Image(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."
精彩评论