Thursday, 23 February 2012

Preventing Caching of JavaScript files in IIS7

When there are a lot of client side scripting involved in the MS CRM project, I normally load external JavaScript files for faster development. Opening external js code files in Notepad++ is readable and looks so much better than CRM web resource text editor and we can save a few seconds of publishing web resource after every modification of the code. But we need to disable caching for JavaScript files in IIS or else we have to delete temporary internet files in Internet Explorer to load the updated script file after each modification of the code.

In order to prevent caching of JavaScript files in IIS7, the Output Caching setting of the MS CRM site in ISS Manager need to be changed.

We need to add one entry in the Output Caching with the File extension name ".js" and enable both User-mode caching and Kernel-mode caching and choose Using file change notifications radio button for both sections. Then, click Advanced button and enable Headers checkbox and enter "Cache-Control" in the textbox.

After all these settings, you'll need to do IISReset and the CRM form will load the latest JavaScript file everytime you modify the external file and refresh the form. Deleting temporary internet files in Internet Explorer is not required anymore.

PS: You may need to delete temporary internet files in Internet Explorer for only once if it's not working after applying all these settings and IISReset.

No comments:

Post a Comment