ScriptCombining Feature

by UnquaLe 7. March 2008 12: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:

Development

Comments

3/7/2008 12:24:24 PM #

trackback


        Trackback from DotNetKicks.com

        ScriptCombining Feature
      

DotNetKicks.com | Reply

3/7/2008 5:26:01 PM #

Mustafa

Nice

Mustafa Turkey | Reply

12/21/2009 3:35:31 PM #

keno spel

ASP.NET Ajax 3.5 SP1 contains a new feature that enables the application developer to combine scripts

keno spel United States | Reply

1/13/2010 8:33:53 AM #

Erhan Hosca

on a related note : http://support.microsoft.com/kb/262161

Erhan Hosca United States | Reply

1/22/2010 11:20:54 PM #

Download free new movies

good... really impressive blog

Download free new movies United States | Reply

1/30/2010 11:21:17 PM #

ppo insurance plans

In .NET 4.0 we're trying to make this more formal and possibly get the page down to a single script that's hostable on a CDN. That will probably look something like this. Just enable CDN (Content Delivery Network) and all your ASP.NET Ajax scripts will come from a CDN that you can configure in global.asax once

ppo insurance plans United States | Reply

2/22/2010 4:45:07 PM #

giocare al casinò virtuale

Script combining is a feature that is part of VS 2008 SP1, and due to its limitation of the # of scripts it can combine, we were not able to support it for all the scenarios and thus its not supported.

giocare al casinò virtuale United States | Reply

3/1/2010 2:05:28 AM #

Fatcow

Should I get a VPS?  I am using shared hosting but they keep turning off my websites due to high server overload. Im getting about 3,000 unique views a day. What hosting should I get?

Fatcow United States | Reply

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen