|
Using Web Forms to Build Interactive Applications |
|
| The Flow of the Code | |
|
If you have experience with VB 6 and "classic" ASP, be prepared for even more dramatic change. ASP.NET is completely different from ASP just like VB.NET is different from VB 6 and ADO.NET is different from ADO. (Just as a comment, the massive scope of all the changes that Microsoft introduced along with .NET really boggles the mind. I still wonder how they did it.) Study the diagram on page 547 of the book. Note how all the code is on the server (Web Forms and Code-behind files). Although a lot of programming in ASP is also on the server, the scripts that made it happen were embedded into the HTML on the client. That has all gone away in ASP.NET. (Client side scripting is still possible and useful when you're using ASP.NET, but it doesn't drive the server side processing anymore. It's been demoted back to the jobs it did before active server systems were invented.) The illustration shows the steps to actually run your VB.NET code (either in ASP.NET or a standalone program ... they're the same). It's important to understand that the steps to compile and execute your program all take place on the server. And since the code is only compiled once on the server, ASP.NET code is very fast in comparison to earlier technologies. In fact, the quick and easy way to change from ASP to ASP.NET is to add runat="server" to your HTML controls. This converts them from standard controls to server controls. For example, if you wanted to convert this standard HTML text box to ASP.NET: You would simply code: This makes it a fully functional server-side control that you can use in your code. You can now work with component events, set attributes, and bind the component to a data source. The IL Code in the illustration is Intermediate Language. .NET creates the same IL Code no matter what programming language you use, so you get the same speed of execution and the same programming libraries whether you are programming in VB.NET, C#, or one of the many other languages that are now .NET compatible. The first time a program is executed on the server, the JIT (Just-In-Time) compiler saves the machine code version in a cache file so this compile step doesn't have to be repeated either. |
|

