ScriptCombining Feature

by UnquaLe 7. March 2008 19:01

I was reading the post (Mix08 Session Overview: Building Great AJAX Applications from Scratch Using ASP.NET 3.5 and Visual Studio 2008) from Brad Abrams then I have seen very cool feature to combine the scripts into a single request that saves the round trip and compresses better.

The text is from his post;

Download the completed sample or just the starter files to play along at home. 

We can use the new ScriptCombining feature to combing the scripts into a single request that saves the round trip time and compresses better.

But first we need to know exactly what scripts are being loaded.  To see this let's look at the ScriptReference debugging tool.

Just drop it on your page

	    <cc2:ScriptReferenceProfiler ID="ScriptReferenceProfiler1" runat="server" /> 
	

and you see exactly what is loaded.

		
	

image

We also, have both the debug and retail scripts ready to download in case we want to share this across several pages.

Then cut and past that into ScriptManager.

			<asp:ScriptManager runat="server" ID="sm">
	<CompositeScript>
	<Scripts>
	<asp:ScriptReference Name="MicrosoftAjax.js" />
	<asp:ScriptReference Name="MicrosoftAjaxWebForms.js" />
	<asp:ScriptReference Name="AjaxControlToolkit.Common.Common.js" 
	Assembly="AjaxControlToolkit, Version=3.0.11119.25533, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
	<asp:ScriptReference Name="AjaxControlToolkit.ExtenderBase.BaseScripts.js" 
	Assembly="AjaxControlToolkit, Version=3.0.11119.25533, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
	<asp:ScriptReference Name="AjaxControlToolkit.TextboxWatermark.TextboxWatermark.js"
	Assembly="AjaxControlToolkit, Version=3.0.11119.25533, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
	<asp:ScriptReference Name="AjaxControlToolkit.Rating.RatingBehavior.js" 
	Assembly="AjaxControlToolkit, Version=3.0.11119.25533, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
	<asp:ScriptReference Name="AjaxControlToolkit.Compat.Timer.Timer.js" 
	Assembly="AjaxControlToolkit, Version=3.0.11119.25533, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
	<asp:ScriptReference Name="AjaxControlToolkit.Animation.Animations.js" 
	Assembly="AjaxControlToolkit, Version=3.0.11119.25533, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
	<asp:ScriptReference Name="AjaxControlToolkit.Animation.AnimationBehavior.js" 
	Assembly="AjaxControlToolkit, Version=3.0.11119.25533, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
	<asp:ScriptReference Name="AjaxControlToolkit.PopupExtender.PopupBehavior.js" 
	Assembly="AjaxControlToolkit, Version=3.0.11119.25533, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
	<asp:ScriptReference Name="AjaxControlToolkit.AutoComplete.AutoCompleteBehavior.js"
	Assembly="AjaxControlToolkit, Version=3.0.11119.25533, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
	<asp:ScriptReference Name="AjaxControlToolkit.ConfirmButton.confirmButtonBehavior.js"
	Assembly="AjaxControlToolkit, Version=3.0.11119.25533, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
	</Scripts>
	</CompositeScript>
	</asp:ScriptManager>
	

Now, let's go back to firebug...

image

This time, we have two request 118KB and 4.39s... Much better!

 

Tags:

How to provide user management for your online site

by UnquaLe 3. March 2008 23:15

As you know, ASP.NET Web Administration Tool works locally only.  In this article you will know how to get it working with the remote websites too. It recommends 2 option for that.

So lets read it. 

Tags: