Although this book will focus on building ASP.NET applications with Visual C# .NET, the development environment you’ll be working in is Visual Studio .NET. Because Visual Studio .NET now supports all of the .NET languages in a single IDE, many of the tasks you’ll learn in this book are applicable to Visual Basic .NET, Visual C++, and JScript .NET, as well as to Visual C# .NET.
You’ll begin your tour by starting the Visual Studio .NET IDE. Next, you’ll learn about some of the features of the IDE designed to help you get started. You’ll finish this section by learning how to open an ASP.NET Web application project.
The exercises in this chapter require that you have installed at minimum the Visual C# .NET Standard Edition, as well as the practice files for the book, which you can download from the book’s Web site at http://www.microsoft.com/mspress/books/6724.asp. If you have not installed both, please do so now and then return to this chapter.
Click the Start button, point to All Programs (or Programs in Windows 2000), and then point to Microsoft Visual Studio .NET 2003.
The icons for Visual Studio .NET will be displayed.
Click the icon for Microsoft Visual Studio .NET 2003.
The Visual Studio .NET IDE will start. The Start Page is displayed by default whenever you start Visual Studio .NET, and provides links and tools to help you configure the IDE, open recent projects, create new projects, and many other tasks. By default, the IDE will display the Projects tab of the Visual Studio .NET Start Page. This tab allows you to quickly open a recent project or to create a new project. The Online Resources tab allows you to find sample code, access online community resources, find .NET downloads, and more. You’ll see more of this tab in a bit. The My Profile tab of the Start Page, shown in the following illustration, allows you to configure the layout of the tool windows in Visual Studio .NET, as well as the keyboard shortcuts used to accomplish common tasks.
Select the My Profile tab, and then change the main Profile drop- down list from Visual Studio Developer to Visual C# Developer.
This will configure the IDE windows and keyboard configuration to match those shown in the following illustration.
Click the Online Resources tab.
By default, the Get Started section will be selected (if it’s not, click Get Started). Here you can search for samples based on the developer profile (Visual Studio, Visual Basic, Visual C++, or Visual C#) and filtered by keyword or type, as shown in the following illustration.
Type ASP.NET in the text box, and then click Go.
Sample applications and code can be useful tools for learning how to develop applications, including ASP.NET applications. But keep in mind that samples are often designed to illustrate a limited set of specific concepts, and might not always use best practices for security and design. Before using sample code in your applications, be sure that you understand the security and architectural implications of doing so.
Switch back to the Projects tab and then click Open Project.
The Open Project dialog box will be displayed, as shown in the following illustration.
Browse to the location where you installed the practice files (the default is C:\MS Press Books\ASPNETSBS_CS), open the Chapter_01 folder, select the Chapter_01.csproj file, and then click Open. (Alternatively, you can open all the projects installed with the practice files by selecting the aspnetsbs.sln file located in the aspnetsbs_cs folder.)
The Chapter_01 project will be loaded. Note that if you open a project originally created with Visual Studio .NET 2002 in Visual Studio .NET 2003, you will be prompted to convert the project file to the newer format. Once this conversion is done, you will not be able to open the project in older versions of Visual Studio .NET.
By default, Windows 2000 and Windows XP hide file extensions for known file types. If this setting is turned on, you will not see the .csproj and/or .sln extensions to the files mentioned earlier. You can modify this setting in the Windows Explorer Folder Options dialog box. From the Windows Explorer Tools menu, select Folder Options and then click on the View tab. Uncheck the Hide Extensions For Known File Types check box, and then click OK or Apply. The file extensions will now appear in the Open Project dialog box.
Running Web applications is a little different than running Windows applications or console applications. With Windows applications and console applications, running the application in the IDE is as simple as clicking the Start button, shown in the following illustration, on the Visual Studio .NET toolbar. Although you can also run a Web application using this technique, it’s more common to simply browse to the page in the application that you want to test. If you want to run a Web application using the Start button (or by selecting Start from the Debug menu), you need to select a page in your application that will be the start page, or the first page loaded when the application is run. You’ll learn about these techniques in Chapter 14, which covers debugging ASP.NET applications. For now, let’s just test a page by browsing it.
Load the Chapter_01 project. (If you’ve been following along in the book, you might have already loaded the Chapter_01 project; if so, skip to the next step. If not, return to the previous section, follow the steps to load the project, and then return to this section.)
In the Solution Explorer window, right-click the Welcome.aspx file, and then select View In Browser.
The Welcome.aspx page, shown in the following illustration, will be loaded into a browser window that is integrated into the IDE. You can browse pages in a Microsoft Internet Explorer external browser window or with browsers other than Internet Explorer by right- clicking a page, selecting Browse With, and then choosing your desired browser and other options.