Step 1 Creating a Project

Launch VS.NET. Click File ® New y Project and select the item Visual C# Projects in the left pane of the New Project dialog (see Figure 4.2). In the right pane, select the Web Application icon (you may need to scroll to see the icon).

Figure 4.2: VS.NET New Project window

By default, C# names your Web application projects WebApplication with an appended number, for example, WebAppiicationi, but you should always enter a specific name. Click in the Name field and enter CSharpASP. Check the Location field; it should contain the name of the Web server you want to host this application. Typically, this will read http://iocaihost. However, you may create a project on any Web server for which you have sufficient permissions to create a virtual directory and write files.

Make sure the information you entered is correct, and then click OK. VS.NET will create the new project.

You should see the Solution Explorer pane (see Figure 4.3). If the Solution Explorer is not visible, select View y Solution Explorer from the menu bar.

Figure 4.3: Solution Explorer pane containing a new project

You'll use the CSharpASP project throughout this book. When C# creates a Web application project, it adds several items to the Solution Explorer pane. I'll explain all these in a minute, but first, create a new folder named ch4. Creating subfolders works exactly like creating subfolders in a Web site: You simply add the name of the folder to the root URL to view a page in that folder. To create the subfolder, right-click the CSharpASP virtual root in the Solution Explorer, click Add, and then click New Folder. Finally, type ch4 for the folder name.

Select the WebForm1.aspx file and drop it on top of your new ch4 folder. When you drop the file, VS.NET will move the ASPX file (and any associated files) into the ch4 folder. If the file is already open, close it first and then move it. Your Solution Explorer pane should look similar to Figure 4.4.

Figure 4.4: Solution Explorer pane after creating the ch4 folder

Was this article helpful?

0 0

Post a comment