Teach Yourself
ASP.NET
in
24
Hours
0-672-32126-2
HOUR
1
This material is not for distributionunedited draft material.
Hour 1
How to install the ASP.NET Framework on your system What tools can be used to create ASP.NET applications How to create an ASP.NET page How to view the output of your ASP.NET pages
What Is ASP.NET?
In the early days of Internet Web site design and development, technologies were limiting. Static HTML pages served up the necessary information that a person wished to convey to his audience. Because technologies were more limiting back then, it was easier to get away with a site that was not as interactive as it needed to be. Nowadays, however, it is important to learn how to build dynamic, interactive Web sites, especially with the increasing use of multimedia elements such as Flash and Shockwave and the development of e-commerce and e-business sites that require database integration. To meet this need, Microsoft created a Web-development platform called Active Server Pages, or ASP. ASP was widely used and accepted throughout the industry because most developers could utilize their existing Visual Basic or VBScript skill sets when developing Web applications. Despite this widespread acceptance, using Active Server Pages was limiting in some respects. For example, validation of form data sometimes required extensive coding on both the client browser and the server. Also, some aspects of Active Server Pages were not scalable in an enterprise environment and didnt function robustly in high-volume sites (although there were ways around these problems). In addition, combining serverside code on the same page as HTML and JavaScript often resulted in Web pages that were a convoluted mixture of server-side logic code and fancy HTML code designed for the user interface, which among other problems made code maintenance a real issue. To overcome these problems and many others, Microsoft has introduced ASP.NETits next-generation Web development environment. If you have experience in programming applications, you will find that the ASP.NET Framework is very similar to building client/server applications. Even if youve never written a line of code in your life, you will find that ASP.NET is a relatively easy programming language to learn.
of users on the Internet will be able to use your Web applications without you needing to write browser-specific code. This feature takes a great burden off the shoulders of current Web developers, although it is still important to be aware that not all browsers accept Dynamic HTML (DHTML) in the same way. For instance, Netscape Navigator versions 4.0 through 4.75 do not allow text on the page to be changed unless the page is reloaded in the browser. Internet Explorer versions 4.0 and higher, on the other hand, do allow text to be changed on the page. These inconsistencies, and many others, still need to be considered when writing client-side code.
Hour 1
Visual C++.NET: Visual C++.NET is the next iteration of Microsofts existing Visual C++ programming language, which is a powerful, object-oriented programming language. Typically, this language is used to create very complex and sophisticated applications. JScript.NET: JScript is a powerful scripting language targeted specifically at the Internet. It is also the first scripting language to fully conform to ECMAScript the Webs only standard scripting language. This language is similar in syntax to C# and C++, although it is a little easier to implement.
, TO DO ,
1. Click the Start button and choose Programs, Administrative Tools, Internet Services Manager. 2. Click the Web server name. On the right side of the screen, Default Web Site should have a status of Running. If this is not the case, highlight Default Web Site by clicking it and then click the Play icon on the toolbar at the top. 3. Clicking the plus sign (+) next to the Web server name will display a list of the available Web sites on this server, as shown in Figure 1.1. 4. Clicking the plus sign (+) next to Default Web Site will display a list of the virtual directories for this Web site, as shown in Figure 1.2. Virtual directories are simply logical directories that can contain physical directories.
FIGURE 1.1 A list of virtual directories is displayed below Default Web Site.
5. Right-click Default Web Site and then select New, Virtual Directory (a virtual directory is a link to another physical directory that resides outside of the Web site tree).
FIGURE 1.2 Creating a virtual directory for the default Web site.
6. Figure 1.3 shows the screen that appears. From this screen, enter the alias that you wish to use to gain access to this directory (for example, ASP_Net_Examples) and then click Next.
FIGURE 1.3 The Virtual Directory Alias screen.
7. In the next screen, shown in Figure 1.4, browse to the location where you want your virtual directory to be and click Next. If no directory has been created for your ASP.NET pages, create one now, calling it C:\Inetpub\wwwroot\ ASP_Net_Examples, for example.
FIGURE 1.4 The Web Site Content Directory screen.
8. In the next screen, shown in Figure 1.5, select the appropriate access permissions for this directory and click Next. The default access permissions are Read and Run Script. These permissions are acceptable for all ASP.NET applications that will be hosted on this server.
FIGURE 1.5 The Access Permissions screen.
9. In the final screen, shown in Figure 1.6, click the Finish button, and the virtual directory will be completed.
FIGURE 1.6 Congratulations! You have finished creating a virtual directory.
The new virtual directory will now appear as a node under the Default Web Site tree. Hour 2, Presenting Internet Information Services, will provide a more detailed overview of the features and benefits of Internet Information Services (IIS) on Windows 2000.
Hour 1
, TO DO
Make certain that your Web server has all the .NET Framework prerequisites installed. You must have Internet Explorer 5.5 as well as MDAC 2.6 installed prior to installing the .NET SDK. Follow these instructions to install the .NET Framework SDK on your Web server: 1. To install Internet Explorer, go to http://www.microsoft.com/windows/ie/ download/ie55sp1.htm and run the IE setup program. 2. Once the setup program is loaded and you have accepted the terms of the license agreement, Internet Explorer 5.5 will be installed on the computer. Reboot when the installation wizard prompts you. 3. Download MDAC 2.6 from http://www.microsoft.com/data/ download_260SDK.htm and install it on your Web server. MDAC 2.6 is necessary on the Web server for retrieving data from a database system such as SQL Server 2000. Follow the installation instructions on the page and continue to the next step when the MDAC installation is completed. 4. You can download a copy of the .NET Framework SDK if you dont already have a copy. Be warned though: The .NET SDK is a 111MB download. You can either download it in one huge file or break it up into 11 smaller downloads, depending on your bandwidth. The URL to retrieve the .NET Framework SDK is http://msdn.microsoft.com/downloads/net. 5. Once youve expanded the .NET Framework SDK download, double-click the setup.exe icon to begin installing the .NET Framework SDK. 6. A message will appear asking whether you want to install the .NET Framework SDK. When you click Yes, the installation program will extract all the .NET installation files necessary to complete the setup process. The .NET Framework SDK extraction process will take a few minutes to complete. 7. Scroll through the screens, pausing to accept the terms and conditions in the licensing agreement, until you reach the Install Options screen presented in Figure 1.7. Make sure the Software Development Kit box is checked; then click the Next button.
8. Choose the destination folder for the .NET Framework SDK and click the Next button. By default, the SDK installs to the directory C:\Program Files\ Microsoft.Net\FramewordSDK\. 9. The installation routine will begin installing the .NET components onto the Web server at this time (see Figure 1.8). Wait for the installation to complete and then reboot, when prompted, for the changes to take effect.
FIGURE 1.8 The .NET Framework SDK installing on the server.
Once the .NET Framework SDK has been installed, you can begin developing ASP.NET applications. In the next hour, you will learn how to create your first ASP.NET page, along with which tools work best in the creation of these types of applications.
Summary
In this hours lesson, you were introduced to ASP.NETpart of Microsofts new .NET Framework strategy for distributed application development. You were also introduced to Internet Information Services on Windows 2000. Finally, you were shown the requirements necessary to host ASP.NET pages and how to install the .NET Framework SDK on your Web server.
Q&A
Q Where can I get more information on the .NET Framework SDK? A The first source of information is the .NET Framework Reference Guide thats installed with the SDK. To access it, click the Start button and then click Programs, Microsoft .NET Framework SDK, Reference Guide. You can also access information from Microsofts Web site at http://msdn.microsoft.com/net or http://www.microsoft.com/net. A third source of information is from newsgroups. Microsoft has set up several newsgroups for discussions of the .NET Framework SDK. The following newsgroups will be of interest to ASP.NET developers: microsoft.public.dotnet.framework.aspnet, microsoft.public.dotnet. framework.aspnet.mobile, and microsoft.public.dotnet.framework.aspnet. webservices. Finally, there are numerous sites devoted to ASP and ASP.NET programming. Some of the ones to visit include www.asp.net, www.gotdotnet.com, www.aspfree.com, and www.asptoday.com. Q Will I be able to run my existing ASP pages along with ASP.NET pages on the same server? A Absolutely! ASP.NET has been designed to coexist in complete harmony with ASP pages on the same server. In fact, you can have half of your Web site done in regular ASP and the other half in ASP.NET. This certainly helps the application migration path from ASP to ASP.NET.
Hour 1
Workshop
The quiz questions and exercises are provided for your further understanding of the material presented. See Appendix A, Answers, for answers to the questions.
Quiz
1. On which operating systems can you install the .NET Framework SDK? 2. What operating systems can host ASP.NET pages? 3. Do ASP.NET pages use interpreted code, where an interpreter reads each line of code in the page for processing, or compiled code, where the page code is compiled into executable code for the Web server?
Exercises
1. Explore the files in the directory of your default Web site. Notice the creation of a new folder called aspx. This folder holds the latest version of the ASP.NET validation code for ASP.NET pages. Do not modify anything in this page without first making a backup copy. Continue navigating your Web server using the Internet Services Manager Console.