Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

I am Jalpesh Vadgama a Microsoft MVP for Visual C# and BrainBench Certified ASP.NET Developer having more then 6 years of experience in .NET Technology.
Browse by Tags · View All
#ASP.NET 88
#DOTNET 87
BRH 79
ASP.NET 72
#.NET 52
C#.NET 48
DOTNET 47
ASP.NET 4.0 31
ASP.NET MVC 29
VisualStudio 27

Archive · View All
December 2010 16
July 2011 13
April 2011 13
April 2012 12
January 2011 12
June 2011 11
May 2011 11
May 2012 8
February 2013 7
January 2013 7

ASP.NET Performance tip- Combine multiple script files into one request with script manager

Dec 30 2010 12:57AM by Jalpesh   

We all need java script for our web application and we storing our JavaScript code in .js files. Now If we have more then .js file then our browser will create a new request for each .js file. Which is a little overhead in terms of performance. If you have very big enterprise application you will have so much over head for this. Asp.net Script Manager provides a feature to combine multiple JavaScript into one request but you must remember that this feature will be available only with .NET Framework 3.5 sp1 or higher versions. 

Let’s take a simple example. I am having two javascript files Jscrip1.js and Jscript2.js both are having separate functions.

//Jscript1.js
function Task1() {
    alert('task1');
    }

Here is another one for another file.

////Jscript1.js
function Task2() {
    alert('task2');
}

Now I am adding script reference with script manager and using this function in my code like this.

 <form id="form1" runat="server">
        <asp:ScriptManager ID="myScriptManager" runat="server" >
            <Scripts>
                <asp:ScriptReference Path="~/JScript1.js" />
                <asp:ScriptReference Path="~/JScript2.js" />
            </Scripts>
        </asp:ScriptManager>
        <script language="javascript" type="text/javascript">
            Task1();
            Task2();           
        </script>
    </form>
Now Let’s test in Firefox with Lori plug-in which will show you how many request are made for this. Here is output of that. You can see 5 Requests are there.LoriPlugin

Now let’s do same thing in with ASP.NET Script Manager combined script feature. Like following

<form id="form1" runat="server">
        <asp:ScriptManager ID="myScriptManager" runat="server" >
            <CompositeScript>
                <Scripts>
                    <asp:ScriptReference Path="~/JScript1.js" />
                    <asp:ScriptReference Path="~/JScript2.js" />
                </Scripts>
                
            </CompositeScript>
        </asp:ScriptManager>
        <script language="javascript" type="text/javascript">
            Task1();
            Task2();           
        </script>
    </form>

Now let’s run it and let’s see how many request are there like following.

LoriPlugin1

As you can see now we have only 4 request compare to 5 request earlier. So script manager combined multiple script into one request. So if you have lots of javascript files you can save your loading time with this with combining multiple script files into one request. Hope you liked it. Stay tuned for more!!!.. Happy programming..

Shout it

Tags: C#.NET, BRH, #DOTNET, #ASP.NET, JavaScript, ASP.NET, Ajax, ScriptManager,


Jalpesh
15 · 11% · 3548
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]