Nov 16 2008

ASP.NET AJAX's CompositeScript in .NET 3.5 SP 1

Category: .NET 3.5 SP1 | ASP.NET AJAXBil@l @ 09:28

The .NET 3,5 SP1 adds several features to the .NET products. One of the major improvements in my opinion regarding the ASP.NET AJAX 3.5 is the CompositeScript.

Usually, when you place a ScriptManager instance on the page, you include several scripts and you place them within the Scripts class collection. This means, if you had like 5 scripts to load, you will have 5 different calls to the server to request the 5 script files.

The improvement in .NET 3.5 SP1 is the addition of the CompositeScript class that allows you to group a collection of script files and have them rendered to the cllient as a single script file and hence instead of requesting 5 script files (according to the example above), you will be requesting a single script and hence minimized the requests to server from 5 to 1.

<asp:ScriptManager ID="ScriptManager1" runat="server">
<CompositeScript>
<Scripts>
<asp:ScriptReference Path="~/Scripts/Script1.js" />
<asp:ScriptReference Path="~/Scripts/Script3.js" />
</Scripts>
</CompositeScript>
</asp:ScriptManager>

 As you can see this has a great improvement in performance since less requests will be issued to the server.

 

Regards

 

Tags: ,