Increase AJAX Performance by combining Scripts using Scriptmanager - Composite Scripts

Scripts Composite - Scriptmanager using Scripts combining by Performance AJAX Increase

Using Microsoft Ajax can cause a lot of Javascript Files (.axd) requests happening on the background.
You can check it by using firebug or fiddler.

The first thing you need to do before combining Ajax scripts is,
You need to know what scripts are being used by your pages.

You can use ScriptReferenceProfiler.
Well if you know your scripts you can just put them into the Scriptmanager CompositeScript Part like the following example shows.

<asp:ScriptManager runat="server">
       <asp:ScriptReference name="MicrosoftAjax.js"/>
       <asp:ScriptReference name="MicrosoftAjaxWebForms.js"/>
       <asp:ScriptReference name="~/CustomScript.js"/>

Best thing is to combine them into one file and make it static.

This means you have to pack these defined Scriptreferences into one file. 

The Scriptmanager ignores the Scriptreferences and expects the code in your defined js file.

To set the path in compositeScript us following:

<asp:CompositeScript Path="~/CompositeScript.js">

And as a results you can decrease the number of request and traffic for this scripts.

Comments are closed