In the past few columns, I've been introducing you to some of the new features in Visual Studio 2005 beta 1. In this column, I want to discuss how ASP.NET is changing. The changes coming at the core level of ASP.NET 2.0 will change the way that Web developers think about Web sites.
In an ASP.NET 1.x Web application, the bin directory contains the precompiled Microsoft Intermediate Language (MSIL) code associated with all parts of that application. This represents one of the biggest drawbacks of ASP.NET 1.x in that a site is compiled into a single executable. Because each Web page is compiled into this executable binary file, you must replace the entire executable if you need to change one Web page on the site. Even worse, you must completely flush the site's cache. Essentially, each update requires a restart of your site, although in most cases, this restart is invisible to users.
With ASP.NET 2.0, instead of having each page compiled into a single executable binary file, the Microsoft IIS engine treats each Web page as a separate executable file. In this respect, ASP.NET 2.0 is similar to Active Server Pages (ASP). With ASP, individual pages are retrieved as the code is interpreted, which results in smaller, more manageable components with which to work. However, unlike ASP, ASP.NET 2.0 builds on the robust caching capabilities and binary compilation models of the Windows .NET Framework. So, ASP.NET 2.0 will offer the best of the present and the past.
One interesting change in ASP.NET 2.0 is how it implements class files. Similar to Windows Forms, you can put some of your logic into an application class file, which is then saved in the code directory of your site. Like .aspx pages (which make up your user interface), your class file is directly deployed to your site and is picked up at runtime. Unlike .aspx files, the class file's code is interpreted and compiled all in one step.
In case I haven't triggered a memory yet, in "Anonymous Admirer" (http://www.windowsitpro.com/windows/article/articleid/43549/43549.html), the one capability I asked for was the ability to take a text stream and have the interpreter compile this code on the fly for use in applications. Although this capability isn't available for Windows Forms-based applications, you can quite literally see it in action in ASP.NET 2.0 applications. Now I don't want anyone to get the mistaken impression that on-the-fly coding is a good practice for production sites. It's not. However, keep in mind that in a production environment in which you might have dozens or even hundreds of users, there's no guarantee that you can write and read a file before another IIS thread attempts to do the same--but somewhere in the ASP.NET 2.0 engine is the logic that does the job.
Another important change in ASP.NET 2.0 is the addition of a feature called Master Pages. Master Pages provide a terrific way to standardize the look and feel of your site. What makes them great is that they aren't limited to just static content; the template that makes up a Master Page can include controls for navigation and standard site actions. Within the Master Page, you designate the area in which each custom page will live. It's a little like a how a page encapsulates a control, but unlike a control, you're still creating individual pages, each with their own custom elements.
What's important to note is that the template name isn't addressed on your site. Instead of having a default .aspx page that handles every request, you'll have a different URL for each unique page. Behind the scenes, these URLs leverage the common application logic stored in your Master Page. The result is that you can follow the intuitive model of creating pages for your site while still leveraging a common framework. In short, the ASP.NET 2.0 runtime environment provides the best of both the ASP and ASP.NET 1.x site implementation models. (For more information about Master Pages, see the Microsoft article "Standardize Your Site Fast With Master Pages" at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnet-standardize-masterpages.asp.)
Besides offering Master Pages, Visual Studio 2005 beta 1 offers new and enhanced controls. As I'll discuss in my next column, these new and improved controls can help reduce the amount of custom code you'll need to support basic operations, which means you can concentrate on designing your applications' features.