Wednesday, March 21, 2012

Web Method Caching

When caching is enabled in a web method, ASP.NET Ajax Extensions set theCacheabilityof theResponse.Cache object toServer. The problem is that the network overhead is still incurred when making a call from JavaScript. Further, as theCacheability is already set toHttpCacheability.Server before the method is called, it is not possible to override it with any other value exceptHttpCacheability.NoCahe. This means that there is no way to implement browser side caching with ASP.NET Ajax web services. This seems to be a pretty stringent rule or am I missing something very obvious?

All I want to do is to save the browser from incurring a network overhead when calling web services. Currently, I have resorted to JavaScript code to do the caching. But it will be nice if web methods can also be cached by the browser.

Hi Rama Krishna,

Take a look at this blog:

http://msmvps.com/blogs/omar/archive/2006/09/23/Atlas-7_3A00_-Caching-web-service-response-on-browser-and-save-bandwidth-significantly.aspx

HTH

Regards,


I have seen that solution, but I don't like the idea of reflection to set the max age as it does not work in medium trust.

No comments:

Post a Comment