Telerik blogs

The 2009 Q3 Service Pack 1 landed in your accounts just minutes ago and it holds a great surprise.

Starting with this release you’ll be able to load the control scripts and skins from the Telerik CDN.

You can deploy your applications with CDN support free of charge. That’s right - we cover all hosting expenses for the CDN.

The Telerik CDN is hosted on the Amazon CloudFront service. This is a global content delivery service with edge locations in the US, Europe and Asia.

supersonic

Coming soon to a cloud near you

Why use a CDN?

Using the Content Delivery Network has a number advantages:

  • Reduced latency – requests will be automatically redirected to the nearest server
  • Better use of caching – each resource only needs to be downloaded once
  • Reduced hosting expenses – we host the resources for you so you can pay less

Caching is what a CDN is all about. Say you have a number of applications that all utilize RadGrid. A customer will load the RadGrid scripts just once and then use the cached version until he clears his browser’s cache. Proxies will also aggressively cache these resources.

The resources on the CDN will be served in a gzip-compressed form for all browsers that support it.

When NOT to use a CDN?

You shouldn’t just always use a CDN. Intranet applications in particular are a bad candidate for it. Your Intranet is likely to be a lot faster than any type of CDN. You’ll also lose the ability to run your application without an Internet connection.

You can’t use CDN with interim releases such as internal builds. We’ll upload and maintain files on the CDN only for official releases.

How to enable the Telerik CDN support?

Now to the sweet details. The first requirement is to have both RadScriptManager and RadStyleSheetManager on your page. You can then enable the CDN support globally from the web.config file:

<appSettings> <add key="Telerik.ScriptManager.TelerikCdn" value="Enabled" /> <add key="Telerik.StyleSheetManager.TelerikCdn" value="Enabled" /> </appSettings> 

You can control the setting on per-instance basis as well:

<telerik:RadScriptManager runat="server" ID="RadScriptManager1"> <CdnSettings TelerikCdn="Enabled" /> </telerik:RadScriptManager> <telerik:RadStyleSheetManager runat="server" ID="RadStyleSheetManager1"> <CdnSettings TelerikCdn="Enabled" /> </telerik:RadStyleSheetManager>

How are end users affected?

The Telerik CDN uses the following host names:

  • http://aspnet-scripts.telerikstatic.com
  • http://aspnet-skins.telerikstatic.com

When a SSL connection is used RadScriptManager and RadStyleSheetManager will fallback to the Amazon S3 service which uses the following hosts:

  • https://telerik-aspnet-scripts.s3.amazonaws.com
  • https://telerik-aspnet-skins.s3.amazonaws.com

Make sure that your visitors have unlimited access to these hosts before enabling the CDN support.

What about the Microsoft CDN?

Microsoft hosts the MS AJAX framework and other ASP.NET scripts on their very own CDN. Using it will further improve the performance of your .NET 3.5 and 4.0 applications. Please, see the recommended settings and notes below.

ASP.NET 4.0 in particular allows you to load everything (including legacy ASP.NET scripts) from their CDN. Please, see this blog post on InfinitiesLoop for more information.

Recommended settings

ASP.NET 2.0

<telerik:RadScriptManager runat="server" ID="RadScriptManager1"> <CdnSettings TelerikCdn="Enabled" /> </telerik:RadScriptManager> <telerik:RadStyleSheetManager runat="server" ID="RadStyleSheetManager1"> <CdnSettings TelerikCdn="Enabled" /> </telerik:RadStyleSheetManager>

The Telerik resources will be loaded from the CDN, MS AJAX will be served by RadScriptManager.

ASP.NET 3.5

<telerik:RadScriptManager runat="server" ID="RadScriptManager1"> <CdnSettings TelerikCdn="Enabled" /> <Scripts> <asp:ScriptReference Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Name="MicrosoftAjax.js" Path="http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js" /> </Scripts> </telerik:RadScriptManager>

Both MS AJAX scripts and Telerik resources will be served from the respective CDNs.

ASP.NET 4.0

<telerik:RadScriptManager runat="server" ID="RadScriptManager1" EnableCdn="true" EnableScriptCombine="false"> <CdnSettings TelerikCdn="Enabled" /> </telerik:RadScriptManager> <telerik:RadStyleSheetManager runat="server" ID="RadStyleSheetManager1"> <CdnSettings TelerikCdn="Enabled" /> </telerik:RadStyleSheetManager>

All ASP.NET scripts and Telerik resources are served from the respective CDNs. Note that we need to disable the script combining in this case in order to serve MS AJAX from the Microsoft CDN. This will be fixed in time for the official .NET 4.0 release.

See it in action!

We’ve updated our WebMail demo to use the Telerik CDN as a demonstration. Please, feel free to give it a try.

More details

Please, consult the online help for more details:

RadScriptManager CDN Support

RadStyleSheetManager CDN Support

 

Your feedback is welcome :)


About the Author

Iana Tsolova

is Product Manager at Telerik’s DevTools division. She joined the company back in the beginning of 2008 as a Support Officer and has since occupied various positions at Telerik, including Senior Support Officer, Team Lead at one of the ASP.NET AJAX teams and Technical Support Director. Iana’s main interests are web development, reading articles related to geography, wild nature and latest renewable energy technologies.

Comments

Comments are disabled in preview mode.