Comparison of ASP and ASP.NET


Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 1.  Getting Started with ASP.NET

ASP.NET is a complete overhaul of traditional Active Server Pages. Therefore, it offers a very different methodology for building Web applications.

If you're familiar with classic ASP, you'll be glad to know that ASP.NET is much more powerful, offering developers a more efficient way to build Web applications. The following sections will discuss some of the general differences between ASP and ASP.NET.


Subsequent days will highlight these differences in sections titled "That's Not ASP!"


Note that although ASP and ASP.NET are completely different, they can operate side-by-side. That is, your Web server can serve both classic ASP and ASP.NET Web pages at the same time. Once you've installed the ASP.NET engine, you won't have to rewrite any of your old ASP pages (although you may want to do so and take advantage of ASP.NET's enhancements).

Fundamental Changes from ASP

Classic ASP was built on top of the Windows operating system and IIS. It was always a separate entity, and therefore its functionality was limited.

ASP.NET, on the other hand, is an integral part of the operating system under the .NET Framework. It shares many of the same objects that traditional applications would use, and all .NET objects are available for ASP.NET's consumption. Instead of being limited to the six inherent objects in ASP, ASP.NET has a plethora of useful components it can build from.

ASP also made it abundantly clear that client and server were two separate entities. Once ASP was finished with its work on the server, it passed the HTML to the client and forgot about it. ASP.NET ties together the client and the server through clever use of server-side and client-side code, all invisible to the developer. Web development is now much more like traditional application development than the disconnected request/response model that ASP development typified.

Furthermore, ASP.NET code is compiled, whereas classic ASP used interpreted scripting languages. Using compiled code means an automatic boost in performance over ASP applications. This makes ASP.NET pages much more like traditional applications, and they'll be treated that way throughout the book.

Because of these and other enhancements, ASP.NET puts a lot of power into the developer's hands. You'll see more of the differences as the book touches on specific topics.

Programmatic Enhancements Over ASP

Along with these fundamental changes, ASP.NET offers many programmatic enhancements, including caching, code compilation, and greater simplicity and security.

Perhaps one of the biggest enhancements in ASP.NET is its ease of deployment. As discussed earlier, metadata stores all necessary information for applications, so you no longer have to register Web applications or COM objects. When deploying classic ASP applications, you needed to copy appropriate DLLs and use REGSVR32.EXE to register the components. With ASP.NET, all you need to do is copy the DLL files. The .NET Framework handles everything else.

Session state was a very important concept in classic ASP. It's the ability to automatically determine if a sequence of requests is coming from the same client, mainly through the use of cookies. This session management made it easy to keep track of users and their actions. Easy-to-build shopping carts and data scrolling were born. However, as Web sites began moving to server farms (collections of servers all handling the same Web site) developers began to see the limitation of ASP-based session management. Namely, sessions weren't transferable across servers.

Session management has become much easier and more powerful with ASP.NET. ASP.NET addresses this issue by providing built-in session support that's scalable across Web farms. It also provides reliability that can even survive server crashes, and it can work with browsers that don't support cookies.

In classic ASP, nearly all of the code was executed in code render blocks (that is, inside <%...%> tags). In ASP.NET, this type of code isn't compiled and isn't recommended for frequent use. Instead, you use the code declaration blocks, which are compiled and provide better performance. Using these blocks also avoids having code and HTML interspersed throughout the page, which makes it very difficult to read through an ASP page. Code declaration blocks can be placed right at the top of the page, separated from the rest of the HTML, and they can still control the visual aspects of the page (see Listing 1.5).

There are many more programmatic enhancements that you'll learn about later in the book. You'll see that everything that was lacking in ASP is now fully implemented and easy to use in ASP.NET.

Differences in Programming Methodologies

Because ASP.NET ties the server and the client together in ways that weren't possible in classic ASP, developing ASP.NET applications requires a more intuitive approach. The developer no longer has to worry about remembering user state information or requesting input variables it's all handled by ASP.NET. Instead, the developer can focus on responding to the user's actions without worrying about the details of the request/response model.

In addition, ASP.NET is now completely object-oriented. Classic ASP strove to introduce the concept of object-oriented programming (OOP), but was unable to because that was a fundamentally different programming paradigm. Developers who are comfortable with aspects of OOP will be happy working with ASP.NET, and those who aren't will find that it's easy to learn and intuitive to use.

ASP developers need not despair, though. Even though there are a lot of changes in ASP.NET, many of your hard-earned skills are still applicable. In fact, you'll see that ASP.NET makes things much easier for you most of the time. ASP.NET is a logical step forward in Internet programming.


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: