Creating Web Sites with ASP.NET 2.0 “Web application development has come a long way in a fairly short period of time.” A quote like that surely won’t send anyone into shock anytime soon because it’s accepted as fact. From basic, static HTML pages to totally data-driven and data-centric Web applications, the demands on a Web developer are much more complex and demanding than they were just a few years ago. The advent of social networking sites like MySpace, which is written in ASP.NET 2.0, interactive mapping sites, and sites streaming full motion video has required the Web developer to adapt and change with the times. One of the best tools to use to build these types of Web applications is Microsoft’s ASP.NET 2.0. In this article I am going to delve into some of the more interesting features of ASP.NET 2.0 and show you how you can begin using ASP.NET 2.0 on your next Web project. ASP.NET 2.0 offers features that every ASP.NET developer will find useful, including: - Multiple project types
- A wide variety of Web controls
- Project folders to help organize files
- Enhanced code-behind model
- Master pages and themes
- Site navigation features
- Enhanced data access features
- Membership and personalization
- Portal architecture including Web parts
- Site administration tools
In this article I’ll take a detailed look at a number of these features including Visual Studio 2005 enhancements, the code-behind model, the Web controls, the master pages feature, the themes and skins feature, and the site navigation features. Creating a Web Site With the release of Visual Studio 2005 SP1, Microsoft offers Web site developers a choice between two different project types: the Web Site and the Web Application. The Web Site project really is not a project at all since Visual Studio 2005 solution and project files are not created. In the Web Site model all pages and code are stored in a directory, much like the traditional ASP model. When it comes to deployment, the easiest approach is to copy all of your files to your Web server and everything compiles on demand. You could also use the aspnet_compiler.exe utility to precompile your site into a binary file and deploy to your Web site. The Web Application project is an implementation of the type of Web project available in Visual Studio 2003 and consists of a solution (.sln) and project files (.vbproj). It is the result of Microsoft listening to the ASP.NET 2.0 developer community and responding to the needs of the community. It provides the benefit of generating a single assembly in the local /bin folder ready for deployment. This model also makes it easier to incrementally deploy changes made to your site. If you are converting a Web application from Visual Studio 2003, this is the project model you are going to want to adopt. I use this model with most of the Web applications I develop. To create a Web site with the Web Application project model, launch Visual Studio 2005 and from the File menu option choose New Project… and the New Project dialog box will appear (Figure 1). Choose ASP.NET Web Application, the name of the project, the location, and the name of the solution if you select to have one created or specify if you want the new project added to the current solution. Click OK and Visual Studio will create the solution (.sln), the project (.vbproj since I selected Visual Basic), a default.aspx page, and a Web.config file.  Figure 1: The New Project dialog box specifies the name, location, and language for your Web Application. To create a Web site with the Web Site project model, launch Visual Studio 2005 and from the File menu option choose New Web Site and the New Web Site dialog box will appear (Figure 2). Choose ASP.NET Web Site, the location of the Web site, the language used, and lastly, the name of the Web site.  Figure 2: The New Web Site dialog box specifies the name, location, and language for your Web site. I don’t need to explain the name of the Web site and the language you want to use but I’ll discuss other options. The location dropdown offers three options: File System, HTTP, and FTP. Creating a File System Web site is the simplest approach because your Web site can reside in any directory on your hard drive or shared network drive. The advantage of a File System Web site is that you can run it using Visual Studio 2005’s built in development Web server. You don’t need IIS though you can use IIS to run a File System Web site by creating a virtual directory for the directory you are storing the Web site in. The second option, choosing HTTP as the location, will direct Visual Studio 2005 to automatically create a Web site in an IIS virtual directory. This saves you the step of creating the virtual directory in IIS but obviously you need to have access to an IIS server. Choosing FTP as the location allows you to actually store and even code your application on a remote Web server somewhere. If you’ve selected this option, click the Browse button to display the Choose Location dialog box and then select a directory, an IIS virtual directory, and then enter the FTP parameters required to log on to an FTP location (Figure 3).  Figure 3: Site location can be FTP folder on a distant server.Once you have decided on the name, location, and language for your new Web site, click OK to create the site. Visual Studio will create a Default.aspx page, Web.config file, and an App_Data folder. One primary difference between the Web Site project model and the Web Application project model is that in the Web Site model settings are stored in a Web.config file as opposed to project file. | & | | 
By: Jim Duffy Jim Duffy is founder and president of TakeNote Technologies, an award-winning training, consulting, and software development company specializing in .NET software developer training and helping clients create business solutions with Microsoft enterprise technologies like Virtual Earth. Jim's expertise is with Visual Studio, Visual Basic, ASP.NET, SQL Server and Visual FoxPro-to-.NET conversions. He has a BS degree in Computer and Information Systems and over 25 years of programming and training experience. He is an energetic trainer, skilled developer, and has been published in leading developer-oriented publications.
Jim is a Microsoft Regional Director, a Microsoft MVP award recipient since 2003, an INETA speaker, and is an entertaining and popular speaker at regional user groups and international developer conferences. He is also a co-host of Computers 2K9, a call-in radio show on WRBZ (AM 850), 850 The Buzz, in Raleigh, NC.
You can find additional information about Jim, TakeNote Technologies, links to his blog, as well as a public training class schedule, on-site training information, consulting information, and software development services at www.takenote.com.
jduffy@takenote.com | Fast Facts | | The ASP.NET 2.0 feature list is impressive. It ranges from high-level issues such as the project structure architecture down all the way down to Web control features such as the Focus method which causes the cursor to appear in a control. | |
|