That s Not ASP


Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 2.  Building ASP.NET Pages

That's Not ASP!

If you're familiar with traditional ASP, you'll notice a lot of differences between it and ASP.NET from today's lesson. A big change is the move from code render blocks to code declaration blocks. Code render blocks used to be the standard method of processing and were preferred over code declaration blocks.

Now code declaration blocks are much preferred because they're compiled and take advantage of the CLR's features. These blocks also make it much easier to separate ASP.NET code from HTML. In fact, code declaration blocks are absolutely required if you want to process events and form submissions. Code render blocks will now throw errors in many situations because the process model has changed.

Another major change is the move from scripting languages to compiled languages. Previously, everyone wrote ASP.NET pages in VBScript, and occasionally JScript. ASP.NET no longer supports these interpreted languages, but you can use any compiled language you want that can produce MSIL, such as VB.NET or C#. This allows you to use features such as early binding and strongly typed variables. The move to compiled languages was definitely worth it. And if you're familiar with VBScript, you can move to VB fairly easily because the two languages are very similar. For more information, check out

ASP.NET is now fully object-oriented as well. Every object fits nicely into the .NET Framework and fully supports OOP principles, such as inheritance, overloading, and interfaces.

One welcome similarity between the two is that Response.Write still works as before. It can be used throughout an ASP.NET page to produce output, or even to provide debugging capabilities (as many ASP developers will attest to). ASP.NET now has some nicer mechanisms to do the latter, as you'll see in Week 3.


Although Response.Write still works, be aware that now you must use it with parentheses. For example, the following will no longer work:

 Response.Write "Hello World!" 

You must enclose the string within parentheses. Appendix B highlights some more of these types of changes, which may cause common mistakes.

The biggest change, although perhaps not the easiest to see, is to the process model of ASP.NET. Code is now compiled into MSIL, and then into machine language with a JIT compiler. Applications are now divided into application domains instead of processes, and files are now organized into assemblies and namespaces. These changes won't mean much to a beginning ASP.NET developer, but they'll become readily apparent when you start to really dig into the .NET Framework.


    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 © 2008-2017.
    If you may any questions please contact us: