|
Improve Productivity With ASP.NET 2.0
The latest version of ASP.NET includes an array of new features, all aimed at making you more productive.
by Peter Vogel
November 7, 2005
Technology Toolbox: ASP.NET 2.0
ASP.NET 2.0 includes everything from new controls to new subsystems, and it incorporates major structural changes that change the way that you'll use ASP.NET. ASP.NET 2.0 features new subsystems that handle common problems (including identifying the user and managing user preferences), convert typical Web development tasks into drag-and-drop controls, provide a more flexible compilation model with simpler deployment, and deliver databinding controls that simplify data access and retrieval. All of these changes have one effect: to make you more productive. You want this upgrade.
Think "more" rather than "different." Much of what you know about using ASP.NET development remains the same—you just have a lot more to learn. But don't panic—Visual Studio 2005 includes a wizard that should convert your ASP.NET 1.* Web sites to ASP.NET 2.0. It won't be without pain, but most sites should convert with a minimum of programmer intervention (see Additional Resources).
However, you don't have to upgrade your existing Web sites to ASP.NET 2.0 if you don't want to. After you install .NET 2.0 on your Web server, you'll discover that the ASP.NET tab on your Web site's property pages lets you specify which version of ASP.NET you want to use with your site. Your existing ASP.NET applications can coexist with ASP.NET 2.0 (or be upgraded with a minimum of fuss), so you should be thinking about when, not if, you want to upgrade (see Figure 1). And after you upgrade, you can start thinking about what you'll do next (see the sidebar, "What's Next for ASP.NET?").
The Visual Studio 2005 toolbox features quite a few more controls than the previous version. Templated controls are more common, such as the Wizard control, which allows you to build a multistep process as a series of templates held in a single control on a single page. Other controls plug holes that existed in ASP.NET 1.*. The Substitution control, for instance, solves a significant problem with caching pages by allowing you to specify a part of a cached page that is to be updated each time the page is requested. In ASP.NET 1.1, only the page displayed in the browser could be requested when the user on clicked a Submit button. In ASP.NET 2.0, cross-page posting allows you to add a button to your page that posts to any page in your site. On the new page, your code can retrieve information from the page that triggered the request, providing a simple solution for implementing help or search pages (or any other page that should be accessible from multiple pages on the site).
However, the real stories in ASP.NET 2.0 are in the structural changes to ASP.NET and in the new ASP.NET subsystems.
Adapt to Structural Changes
Solution Explorer exposes the first set of structural differences that you're going to have to adapt to. The key change is easy to miss: The entry at the top of the listing for the Web site is a file path rather than the name of a project. Visual Studio 2005 considers all the files in a directory part of a Web site and doesn't require a project file to list a project's resources. All the other information formerly stored in the project file has migrated to the Web.Config file.
It's also easy to see that the file structure for your Web site is more complicated. Instead of the single required /bin folder for holding your application, there are a variety of specialized folders for holding your application's components. The App_Data folder holds database files (including SQL Server MDF files), and the App_Code folder holds both the source code for any class files that make up your project and the code-behind files for your ASMX Web service pages. You don't have to use these folders if you don't want to, but they will make your life easier. Adding a database file to the App_Data folder adds the database to Server Explorer automatically. Deploying your application is also easier: Picking Web Site | Copy Web Site copies the whole Web site folder, automatically moving the databases in App_Data and the class files in App_Code to the target Web site.
Treating all the files in a directory as the Web site makes debugging much simpler. When you press the F5 button to test your site, Visual Studio 2005 starts up its own development Web server, which you can access only from a browser started from Visual Studio 2005 (see Figure 2). The server stays up and running in the system tray as long as you continue to work with your project, but the server can only be used to access your development directory. You don't need IIS to test your site any more, and organizations that were concerned about installing IIS on developers' computers should find their fears allayed by the development server.
Back to top
|