views:

217

answers:

1

We have a number of small but useful WCF services which are being hosted using the WebScriptServiceHostFactory class and consumed via ASP.NET AJAX. We've noticed that in our production environment that the javascript proxies are not being cached by the client. Is there anyway to allow these files to be cached?

A: 

Have you tried adding caching data to the http headers?

// Add HttpCaching data to the http headers

if (!IsJavascriptDebug && (
    AssemblyModifiedDate.ToUniversalTime() < DateTime.UtcNow))
{
    HttpCachePolicy cache = context.Response.Cache;
    cache.SetCacheability(HttpCacheability.Public);
    cache.SetLastModified(AssemblyModifiedDate);
}

Not my code, taken from codeproject. link text

KClough
I'm not sure how I can add code to the javascript proxy generation. Any ideas?
Stephen Newman
So you are trying to cache the javascript proxy location? Have you considered using cookies as a cache? It is a little backwards, but it should work.
KClough