In Part 2 we looked at the programmatic advantages ASP.NET provides over ASP. In this section we'll briefly look at the how ASP.NET changes the programming fundamentals of creating server-side scripts. Also, I'll chime in with my opinions on ASP.NET...
Fundamental Changes to Programming Web Scripts Using ASP.NET
As I mentioned earlier in this article, ASP.NET changes the fundamental way that Web pages are created. ASP pages are created very procedurally. Each task is usually separated out into a separate ASP page, and, on each ASP page, the tasks needing to be accomplished are coded in sequential order. For example, if you wanted to allow a user to enter his or her name and then display the person's name, you'd likely create two ASP pages: the first page would generate a form with a text box into which the user could enter his or her name. The second ASP page would be specified as the form's
ACTION and would simply output the value the user inputted into
the form on the first ASP page (for example,
Response.Write "Hello, " & Request.Form("Name")).
With ASP pages, it is essential that the developer understand what is happening on the client's end and what is happening on the Web server's end. As illustrated in our above example, gathering input from the user usually requires numerous ASP pages; simply put, collecting user input requires a round trip to the server and the developer must be aware of this round trip.
ASP.NET still requires this round trip to collect user input, but the developer does not need to concern himself with these pesky details. ASP.NET pages are created much more like VB apps. Our two-paged ASP example above could be easily coded in a few lines of code in a single ASP.NET page:
Pretty neat looking, eh!? Looks more like a VB file than a Web page, doesn't it? We have a function,
SubmitButton_Clicked that is seemingly executed when the user clicks on the button created by
asp:button server control. This function then outputs the name entered by the user in the
server control text box.
My Views on ASP.NET
First off, ASP.NET is very cool. It is a neat way of doing things using a different approach and ASP.NET does have many performance, scalability, and deployment advantages over ASP. Regardless, I encourage you not to give up on ASP anytime soon! First off, ASP and ASP.NET can run on the same box simultaneously! Second, ASP.NET is still a looooooooong time away... a final version will not be shipped at least for another six months, and I wouldn't be surprised if it took a full year.
What I really like about ASP.NET is the caching options and the fact that ASP.NET pages are compiled. Although not discussed in this article, the Visual Studio team has introduced a new language, C# (pronounce C-sharp), which is a successor to Java. This new language can be used to create ASP pages, and is really cool since it is the a lot like C but without many of the C-annoyances.
Well, that about wraps up this article. There are a number of great ASP.NET articles available on the Web, so be sure to check out the ASP.NET Article Index!