Microsoft's AJAX Content Delivery Network

Exploring ASP.NET & Web Development

Microsoft's AJAX Content Delivery Network

By Don Kiely

Modern web pages consist of not just the page content but a cacophony of support files: style sheets, script files, images, and more. When a user loads the page, the browser downloads the main .html file (or more likely the .aspx or .jsp or whatever file), then starts up a back and forth conversation with the original web server and other servers to grab all the bits and pieces that fit together to display a beautiful, interactive web page to the user. The browser will cache as much of that content as it can and is allowed to, but it can be an extra load on your web server for the files it hosts.

Microsoft has a solution for part of the problem. It has set up a Content Delivery Network (CDN) to host, initially, the .js files that comprise version 4.0 of its AJAX framework and jQuery 1.3.2. So instead of including a <script> tag with a src attribute that links back to your web server, you can use Microsoft's CDN for each of the files. For example, this tag grabs the main AJAX file from the CDN (this is preview 5, released in September):

<script src="

/0909/MicrosoftAjax.js" type="text/javascript"></script>

Already your site has benefitted because your server doesn't have to use the bandwidth to provide the script files. This reduces your server's load, and you don't have to pay for the bandwidth to download the files. The browser hits Microsoft's server instead, and Microsoft has virtually infinite bandwidth. The browser can also cache the files across multiple websites, since the files are no longer associated with a specific, non-Microsoft domain.

But it gets even better.

The CDN isn't just a server sitting in Redmond that serves up these requests. It's an entire network of servers located, as Scott Guthrie describes, around the world at key Internet network points. This means that requests are routed to the nearest CDN node, no matter where your web server is located. So the download is fast, with minimal network hops. If the page uses a lot of the files hosted on the CDN, page performance should improve noticeably.

As of this writing, all the AJAX 4.0 preview 5 files are included in the CDN, as well as jQuery 1.3.2 and jQuery Validation 1.5.5. Presumably Microsoft will continue to add later preview and beta releases as well as other resources that it provides.

ASP.NET 4.0 will have direct support for the CDN. The Script Manager includes an EnableCdn property that when set to true will grab the files from the CDN. This will include the JavaScript files for AJAX as well as those for the built-in Web Forms. With this enhancement, the number of files the browser will have to grab from your server will go down even further.

A Few Caveats

One downside in this initial release of the CDN is that it doesn't yet support SSL. This means that if your browser is accessing a web page using the HTTPS protocol, users will get the warning dialog box that the page has mixed secure and unsecure content. This seems to be a particular problem in Internet Explorer. SSL support is coming, according to Microsoft. In the meantime, it would probably be better to host the AJAX and jQuery files on your web server for secure pages.

Another potential problem is the domain used for the CDN requests: Since this is a Microsoft domain, the browser passes along any Microsoft cookies that happen to be on the user's machine. This isn't anything strange or unusual, but it's definitely something to be aware of. Of course, this isn't as much of an issue if the user has third-party cookies turned off.

Nevertheless, in the right scenarios the Microsoft AJAX CDN can provide a nice boost to website performance and maybe even save you some money that you'd otherwise pay for bandwidth. Not bad for a free service that is usable on both commercial and non-commercial websites!


Scott Guthrie's Announcement of the Microsoft AJAX CDN blog post. As the father of ASP.NET, ScottGu gets to announce all the cool new stuff that the ASP.NET and related teams release. Here Scott announces the AJAX CDN and talks about some of the technical infrastructure.

Microsoft AJAX CDN information page. This is the main source of information about the CDN, where you can get the code to implement it in your web pages and get a full list of files available. (This list will grow longer over time.) You can also find the CDN Terms of Use for the definitive answers (in legalese) of what you can and can't do with the CDN. Watch this page for changes over time.

Don Kiely ([email protected]), MVP, MCSD, is a senior technology consultant, building custom applications and providing business and technology consulting services. His development work involves tools such as SQL Server, Visual Basic, C#, ASP.NET, and Microsoft Office.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.