Sunday, March 6, 2011

How do I get ASP.Net CompositeScript to cache in the browser?

I have been trying to improve the performance of a web page that references several separate javascript files. I found the new CompositeScript feature in .Net 3.5 SP1 that allows you to combine scripts at runtime through the ScriptManager and it works great to reduce the number of hits on our server at page load.

But the problem is that the combined script never caches on the client side. From everything I've read so far it should do that automatically. I don't have anything set to prevent it from caching (other scripts we reference that could not be combined cache fine, as do the ScriptResource.axd files). I even added the following to explicitly enable caching in the web.config:

<system.web.extensions>
 <scripting>
  <scriptResourceHandler enableCompression="true" enableCaching="true"/>
 </scripting>
</system.web.extensions>

But it doesn't seem to have an effect.

Has anyone seen this problem or have some suggestions on things I can try to fix it?

From stackoverflow
  • Is debug mode on anywhere? Make sure your webserver's Machine.Config has Retail="True"

    <configuration>
    <system.web>
    <deployment retail="true"/>
    </system.web>
    </configuration>
    

0 comments:

Post a Comment