That s Not ASP


Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 5.  Beginning Web Forms

That's Not ASP!

The Web forms model is unlike anything in traditional ASP. Back then, there was no way for the server to keep track of controls, or even to create UI controls to display to the client. A developer could build a system that performed similarly to Web forms, but it look a lot of time and expertise.

Traditional ASP relied on the request/response model for interacting with users. There was no event-driven model to provide a layer of abstraction between the user interface and the application logic. Developers had to process pages linearly (and all at once) when they were submitted, instead of reacting to user events.

Additionally, because the Web is stateless, all form information was lost once submitted. That is, unless the developer explicitly took action to prevent it by retrieving form variables. For example, the following code was a typical sight in classic ASP:

 <input type="text" name="tbName"    value="<% = Request.Form("tbName") %>"> 

Developers constantly had to repopulate the form elements if they wanted to provide the illusion of a persistent state. ASP.NET saves viewstate automatically for you, so you don't have to worry about that any more.

HTML and Web server controls are completely new in ASP.NET. The server's capability to create UI elements and keep track of their states is revolutionary. The best way to develop powerful applications is for the code to know what's going on in the UI in other words, the server knows what the client is doing.

These controls also render properly for each browser, outputting the correct HTML for different versions a far cry from classic ASP. Multiple versions of pages often had to be created for different browser versions, which was a nightmare.

The Web forms framework is a huge boon for Web developers, both in UI creation and in application logic. Once you've been developing with Web forms for a while, you'll wonder how you ever lived without them!


    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: