<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jesal gadhia &#187; ajax</title>
	<atom:link href="http://jesal.us/tag/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://jesal.us</link>
	<description></description>
	<lastBuildDate>Fri, 19 Mar 2010 05:32:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Three quick ways optimize AJAX driven websites in ASP.NET</title>
		<link>http://jesal.us/2008/04/three-quick-ways-optimize-ajax-driven-websites-in-aspnet/</link>
		<comments>http://jesal.us/2008/04/three-quick-ways-optimize-ajax-driven-websites-in-aspnet/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 22:02:17 +0000</pubDate>
		<dc:creator>J</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[asp.net]]></category>

		<guid isPermaLink="false">http://jesal.us/blog/?p=84</guid>
		<description><![CDATA[Recently I was involved in a project where I had to make heavy use of AJAX. I realized there are a few simple things you could do to improve performance.
1) Combine scripts



&#60;ajaxToolkit:ToolkitScriptManager ID="TSM1" runat="Server"
EnablePartialRendering="true"
CombineScriptsHandlerUrl="~/CombineScriptsHandler.ashx" /&#62;

As the name of the property suggests, it will pretty much combine all the needed JS files into one which in [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was involved in a project where I had to make heavy use of AJAX. I realized there are a few simple things you could do to improve performance.</p>
<p><strong>1) Combine scripts<br />
</strong></p>
<p><!--<br />
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red0\green0\blue0;\red255\green0\blue0;}??\fs20 \cf1 &amp;lt;\cf3 ajaxToolkit\cf1 :\cf3 ToolkitScriptManager\cf0  \cf5 ID\cf1 ="ScriptManager1"\cf0  \cf5 runat\cf1 ="Server"\cf0  \cf5 EnablePartialRendering\cf1 ="true"\par ??\cf0     \cf5 CombineScriptsHandlerUrl\cf1 ="~/CombineScriptsHandler.ashx"\cf0  \cf1 /&amp;gt;}<br />
--></p>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white;">
<pre style="margin: 0px;"><span style="color: blue;">&lt;</span><span style="color: #a31515;">ajaxToolkit</span><span style="color: blue;">:</span><span style="color: #a31515;">ToolkitScriptManager</span> <span style="color: red;">ID</span><span style="color: red;">="</span><span><span style="color: blue;">TSM1</span></span><span style="color: red;">" runat</span><span style="color: blue;">="Server"</span>
<span style="color: red;">EnablePartialRendering</span><span style="color: blue;">="true"</span>
<strong><span style="color: red;">CombineScriptsHandlerUrl</span><span style="color: blue;">="~/CombineScriptsHandler.ashx"</span></strong> <span style="color: blue;">/&gt;</span></pre>
</div>
<p>As the name of the property suggests, it will pretty much combine all the needed JS files into one which in turn will reduce the number of requests sent to the server. You can find a detailed discussion about this <a href="http://blogs.msdn.com/delay/archive/2007/06/20/script-combining-made-better-overview-of-improvements-to-the-ajax-control-toolkit-s-toolkitscriptmanager.aspx" target="_blank">here</a>.</p>
<p>It is pretty easy to implement; instead of using the regular ScriptManager, just switch to the ToolkitScriptManager which comes with the AjaxToolkit and then set its CombineScriptsHandlerUrl property as shown above and throw the CombineScriptsHandler.ashx (included in the &#8220;SampleWebSite&#8221; directory of AjaxControlToolkit&#8217;s <a href="http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx" target="_blank">release package</a>) into the root.</p>
<p><strong>2) Run in release mode</strong></p>
<p>The debug versions of the AJAX library have their source formatting preserved, as well as some debug asserts. By running it in release mode you can shave off some bytes off your requests.</p>
<p><!--<br />
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red0\green0\blue0;\red255\green0\blue0;}??\fs20 \cf1 &amp;lt;\cf3 ajaxToolkit\cf1 :\cf3 ToolkitScriptManager\cf0  \cf5 ID\cf1 ="ToolkitScriptManager1"\cf0  \cf5 runat\cf1 ="Server"\cf0  \cf5 EnablePartialRendering\cf1 ="true"\par ??\cf0     \cf5 ScriptMode\cf1 ="Release"\cf0  \cf5 CombineScriptsHandlerUrl\cf1 ="~/CombineScriptsHandler.ashx"\cf0  \cf1 /&amp;gt;\par ??}<br />
--></p>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white;">
<pre style="margin: 0px;"><span style="color: blue;">&lt;</span><span style="color: #a31515;">ajaxToolkit</span><span style="color: blue;">:</span><span style="color: #a31515;">ToolkitScriptManager</span> <span style="color: red;">ID</span><span style="color: blue;">="TSM1"</span> <span style="color: red;">runat</span><span style="color: blue;">="Server"</span> <span style="color: red;">
EnablePartialRendering</span><span style="color: blue;">="true" </span><strong><span style="color: red;">ScriptMode</span><span style="color: blue;">="Release"</span></strong> <span style="color: blue;">/&gt;</span></pre>
</div>
<p>Although, its important to note that some versions of Safari don&#8217;t seem to be compatible with this and could cause many strange side effects as <a href="http://blog.tatham.oddie.com.au/2007/05/31/aspnet-ajax-is-a-pos-designed-by-naive-microsoft-universe-programmers/" target="_blank">this person</a> and I have experienced in the past.</p>
<p>On a side note, ASP.NET AJAX Control Toolkit officially <a href="http://msdn2.microsoft.com/en-us/library/bb470452.aspx" target="_blank">does not support </a><span class="m2"><span class="m2"><a href="http://msdn2.microsoft.com/en-us/library/bb470452.aspx" target="_blank">Macs with PowerPC processors</a>, its good to know that piece of information if a client ever demands an explanation as for why AJAX powered functionality seems to be broken or not functioning as expected in that environment.<br />
</span></span></p>
<p><strong>3) Enable script caching and compression in web.config</strong><br />
<!--<br />
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs20 \cf1 &amp;lt;\cf3 system.web.extensions\cf1 &amp;gt;\par ??\tab &amp;lt;\cf3 scripting\cf1 &amp;gt;\par ??\tab \tab &amp;lt;\cf3 scriptResourceHandler\cf1  \cf4 enableCompression\cf1 =\cf0 "\cf1 true\cf0 "\cf1  \cf4 enableCaching\cf1 =\cf0 "\cf1 true\cf0 "\cf1 /&amp;gt;\par ??\tab &amp;lt;/\cf3 scripting\cf1 &amp;gt;\par ??&amp;lt;/\cf3 system.web.extensions\cf1 &amp;gt;}<br />
--></p>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white;">
<pre style="margin: 0px;"><span style="color: blue;">
&lt;</span><span style="color: #a31515;">system.web.extensions</span><span style="color: blue;">&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">  &lt;</span><span style="color: #a31515;">scripting</span><span style="color: blue;">&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">    &lt;</span><span style="color: #a31515;">scriptResourceHandler</span><span style="color: blue;"> </span><span style="color: red;">enableCompression</span><span style="color: blue;">=</span>"<span style="color: blue;">true</span>"<span style="color: blue;">
</span><span style="color: red;">     enableCaching</span><span style="color: blue;">=</span>"<span style="color: blue;">true</span>"<span style="color: blue;">/&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">  &lt;/</span><span style="color: #a31515;">scripting</span><span style="color: blue;">&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">&lt;/</span><span style="color: #a31515;">system.web.extensions</span><span style="color: blue;">&gt;</span></pre>
</div>
<p>This will compress and cache all the script files which are embedded as resources in an assembly, localization objects, and scripts that are served by the script resource handler.</p>
<p>But like the previous tip, there is a exception to this one too. Some versions of IE6 have a bug where they cant&#8217;t handle GZIP&#8217;d script files correctly. The RTM version of ASP.NET AJAX works around this by explicitly not compressing files for these versions of IE. Although if you are still having a problem, it just might be a safe bet to explicitly set the enableCompression property to false in the web.config.</p>
]]></content:encoded>
			<wfw:commentRss>http://jesal.us/2008/04/three-quick-ways-optimize-ajax-driven-websites-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
