O'Reilly logo

Learning ASP.NET 2.0 with AJAX by Dan Hurwitz, Jesse Liberty, Brian MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a New Web Site

To get started, open the Integrated Development Environment (IDE), which for these purposes is either Visual Web Developer or Visual Studio. (Throughout this book, we will use the acronym IDE for both, specifically using VS or VWD only where they are different.)

This is what the HelloWorld web site will look like after the user clicks the Button.

Figure 1-1. This is what the HelloWorld web site will look like after the user clicks the Button.

To create a new web site, click on the menu item File → New Web Site…, or alternatively, use the Create: Web Site… link on the Start Page. Either way, you should see the New Web Site dialog, like the one shown in Figure 1-2.

Tip

In this book, we will be using Visual Basic as our default language, although it is the profound belief of the authors that Visual Basic and C# are really a single language, just with slightly different syntax.

We will be showing many of our screen shots from Visual Web Developer, because it is freely available from Microsoft, however, anything that can be done in Visual Web developer can also be done in Visual Studio.

Take another look at Figure 1-2, and we'll examine it in some detail. In the upper part of the window, you are offered various Visual Studio templates (though yours may vary). Select the ASP.NET Web Site template, because that is the kind of site that you are going to create (shown circled in this figure).

In the Location drop-down box at the bottom of the dialog box, select File System (the other options are HTTP or FTP; we'll explain this selection later in the next section).

The Location drop-down in Figure 1-2 covers up another drop-down in which we have set the language to Visual Basic (rather than to Visual C# or Visual J#). Finally, you need to specify where on your disk you would like this web site to be placed—in this case, in the LearnASP directory on the C drive.

To create a new web site, open the IDE, and click on Menu → New Web Site to open the New Web Site dialog box. The Templates and My Templates panels show you the types of sites supported by your version of Visual Studio.

Figure 1-2. To create a new web site, open the IDE, and click on Menu → New Web Site to open the New Web Site dialog box. The Templates and My Templates panels show you the types of sites supported by your version of Visual Studio.

The name of the new web site will be Hello World (with no space character). The site will be fully contained in a subdirectory named HelloWorld within the directory LearningASP.

Click OK; the IDE will create the directory for you, put the needed default files for your site within it, and then open the IDE.

You can confirm that the files are in the right place by navigating to the specified directory using Windows Explorer, as shown in Figure 1-3. When you work on your site, however, you'll most likely access these files through the Solution Explorer window located on the right-hand side of the IDE window.

The Location field in Figure 1-2 is really comprised of two parts: a drop-down with three possible values, and a text box for the folder name and path. The drop-down choices are File System, HTTP, and FTP.

File System is the default choice for new web sites and the only choice we'll be using in this book. It creates a new web site folder somewhere on the physical file system, either on your local machine or your network. One important feature of ASP.NET is that an entire web site can be contained within a directory. This is extremely convenient not only for deploying your web site to a web server, but as a side benefit, it allows us to easily place samples from this book onto our web site for you to download and try on your local machine.

Visual Studio creates a new web site directory for you, complete with the default files it requires.

Figure 1-3. Visual Studio creates a new web site directory for you, complete with the default files it requires.

When you create your web site, you can use the Browse button (lower-right corner in Figure 1-2), and its associated drop-down, to browse the file system as you would with Windows Explorer, and select any desired folder as the "home" for your new web site folder.

When you run your file system-based web application from within the IDE, the development environment runs the application using its own internal web server, rather than a web server program such as Microsoft Internet Information Server (IIS). This means that you can easily develop web sites on your machine without the necessity of installing IIS.

The alternatives to hosting your site in your file system are named HTTP and FTP. HTTP indicates that IIS will be serving the pages, and requires that the web application be located in an IIS virtual directory. If you choose HTTP, the IDE will automatically create this virtual directory for you and the web site will be served by IIS.

FTP allows you to develop your web site on a remote location accessible via the FTP protocol. You will be presented with an FTP Log On dialog box with a checkbox to allow Anonymous Log in, and textboxes for login user name and password, if necessary.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required