Sams Teach Yourself ASP.NET in 21 Days, Second Edition By Chris Payne
Table of Contents
Day 6. Learning More About Web Forms
That's Not ASP!
There's not much comparison between today's lesson and classic ASP.NET. The Web forms framework is completely new, as are the custom and user controls. However, you can draw some parallels to the older technology.
User controls are similar to server-side includes, which were often used to encapsulate portions of the user interface for reuse on many pages. Although they could contain code to handle the UI, they weren't accessible programmatically from the containing ASP page. User controls greatly expand on server-side includes, providing ASP.NET with complete information about the encapsulated UI. ASP.NET can create and assign properties to user controls and doesn't need to worry about the implementation. All the unnecessary details are hidden. It's important to make the distinction that user controls are completely self-contained objects that can enhance your pages, while server-side includes merely allow you to divide code into separate pages for reuse.
The closest parallel to custom controls in classic ASP is COM objects. These objects were created from scratch by a developer to provide reusable functionality. However, COM objects didn't provide UI information (although they could if needed). Custom controls provide reusable functionality as it applies to the UI. You wouldn't normally create a custom control that doesn't contain UI information. The way ASP.NET interacts with COM objects and custom controls is completely different. For more information about how COM objects play a part in ASP.NET, see Day 15.