<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>CDN - Kennydust</title>
        <description>Thoughts from a C# Developer</description>
        <link>/site.aspx/Tags/CDN/RSS</link>
        <language>en</language>
        <image>
            <url>http://www.kennydust.com/Content/icons/flame.png</url>
            <title>Kennydust</title>
            <link>/site.aspx/Tags/CDN/RSS</link>
            <width>64</width>
            <height>64</height>
        </image>
        <item>
            <dc:creator>kennydust</dc:creator>
            <title>Microsoft AJAX CDN for ASP.NET 3.5</title>
            <description>&lt;p&gt;Late last year, &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2009/09/15/announcing-the-microsoft-ajax-cdn.aspx&quot; target=&quot;_blank&quot;&gt;Microsoft announced&lt;/a&gt; the launch of their caching support service aka their &lt;a href=&quot;http://www.asp.net/ajaxlibrary/CDN.ashx&quot; target=&quot;_blank&quot;&gt;CDN service&lt;/a&gt;, for their ASP.NET AJAX libraries (and the third party jquery libraries) at no cost. Sweet!&lt;/p&gt;  &lt;p&gt;The problem was, you needed to be up-to-date on ASP.NET 4.0 framework stack in order to take advantage of it. Luckily, the community banned together in an uproar, and shortly thereafter a fix was released. While it’s practically plug-and-play if you’ve running ASP.NET 4.0, some custom code is required to get it to work correctly in the 3.5 framework. I ran across an excellent &lt;a href=&quot;http://blog.turlov.com/2009/11/using-microsoft-ajax-library-35-with.html&quot; target=&quot;_blank&quot;&gt;blog&lt;/a&gt; about this, and it details much more than I was looking for.&lt;/p&gt;  &lt;p&gt;To paraphrase, you need to define a &amp;lt;script&amp;gt; region in your scriptmanager instance and hardcode the CDN path, this will override the default local script reference location:&lt;/p&gt;  

&lt;pre class=&quot;brush: xml;&quot;&gt;
&lt;asp:scriptmanager runat=&quot;server&quot; enablepartialrendering=&quot;false&quot;&gt;
  &lt;scripts&gt;           
    &lt;asp:scriptreference name=&quot;MicrosoftAjax.js&quot; path=&quot;http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js&quot; /&gt;
  &lt;/scripts&gt;  
&lt;/asp:ScriptManager&gt;
&lt;/pre&gt;

&lt;p&gt;I wanted to encapulate the logic a little better, so I wrote a small control that inherits the scriptmanager, and conditionally loads from the CDN, because I work without an internet connection at times:&lt;/p&gt;
&lt;pre class=&quot;brush: c#;&quot;&gt;
    public class CustomScriptManagerControl : ScriptManager
    {
        /// &lt;summary&gt;
        /// Microsoft Ajax 3.5 reference.
        /// &lt;/summary&gt;
        private const string CDN_PATH = &quot;http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js&quot;;

        protected override void OnInit(EventArgs e)
        {

#if !DEBUG
            Scripts.Add(new ScriptReference { Name = &quot;MicrosoftAjax.js&quot;, Path = CDN_PATH });
#endif

            base.OnInit(e);
        }
    }
&lt;/pre&gt;

&lt;p&gt;this is called in my consuming page:&lt;/p&gt;
&lt;pre class=&quot;brush: xml;&quot;&gt;
&lt;c:CustomScriptManagerControl runat=&quot;server&quot; EnablePartialRendering=&quot;true&quot; /&gt;
&lt;/pre&gt;</description>
            <link>http://www.kennydust.com/site.aspx/Blog/Microsoft-AJAX-CDN-for-ASPNET-35</link>
            <guid isPermaLink="true">http://www.kennydust.com/site.aspx/Blog/Microsoft-AJAX-CDN-for-ASPNET-35</guid>
            <pubDate>Tue, 02 Mar 2010 18:39:00 GMT</pubDate>
            <category>AJAX</category>
            <category>CDN</category>
        </item>
    </channel>
</rss>

