Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


September 01, 2004

ASP.NET 2.0 Will Offer the Best of the Present and the Past, Part 1

RSS
Subscribe to Windows IT Pro | See More Active Server Pages (ASP) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

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.

End of Article



Reader Comments
I know that comiling on the fly can be done and its not so hard to do. I've done it to build a 'script engine'. So I have to take exception with your comment in this article.

FrankW September 03, 2004 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Microsoft Kills OneCare, Will Launch Free Security Solution

Microsoft on Tuesday announced that it would retire its $50-a-year security subscription product, Windows Live OneCare, and replace it with a free solution codenamed "Morro." Unlike OneCare, however, Morro will focus only on core anti-malware features and ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

The website is down because someone removed the X-Box

What happens when a manager mistakes a server for a games console. ...


Development Whitepapers Batch Job Scheduling and .NET in 2008

Batch Job Scheduling and .NET in 2008

Related Events Check out our list of Free Email Newsletters!

Related .NET Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing