efore we can dive in and begin building Web pages with ASP.NET, I want to introduce a few topics and new terminology.
Microsoft designed classes in the .NET Framework to accommodate your current programming needs and beyond. It contains classes for many activities including manipulating text, working with database data, and working with the file system. The .NET Framework also contains classes that represent the basic data types including integers, bytes, strings, and arrays. You should learn one of the .NET languages, but it is vital that you learn about the .NET Framework. Do you have to know how to use every class in the Framework before you can become an effective .NET developer? No, but there are quite a few classes you need to learn about before you will make any substantial headway. When it comes to developing in .NET, the Framework is everything.
|ASP.NET is actually built into the .NET Framework. You technically don't even need Visual Studio .NET to write ASP.NET code.
|Interesting Fact #1: For more information about programming languages supported in .NET see the CoDe Magazine Sep/Oct 2002 issue.|
As you can probably imagine, the entire .NET Framework is huge. It is comprised of thousands of classes, or as astronomer Carl Sagan might say, "billions and billions!" Management and classification of this enormous list of classes requires an organizational mechanism. The organizational mechanism that manages the .NET Framework is called a namespace
. Simply put, a namespace is a logical grouping of classes. For example, the System.Web namespace stores all of the classes that relate to working with browser-server communication.
The .NET Framework organizes namespaces into a hierarchical tree structure. The System namespace resides at the root of this tree. It contains all of the classes for working with the base data types, random numbers, dates, directories, and other system resources.
To uniquely identify a class in the .NET Framework, you reference the class by its full namespace and class name. For example, to refer to the File class contained in the System.IO namespace you would use:
shows a partial list of standard namespaces.
Table 1: Partial list of standard namespaces.
The root namespace for the entire .NET Framework. Contains the base types and other useful classes.
Contains classes for working with the standard collection types.
Contains classes for working with Web configuration files (web.config).
Contains classes for interaction with data sources (ADO.NET).
Contains classes for accessing Active Directory Services.
Contains classes for reading and writing files.
Contains classes for working with strings.
Contains classes that process XML data.
.NET supports a number of languages. By default, Visual Studio .NET installs Visual C# .NET (usually abbreviated as C# and pronounced c-sharp), Visual Basic .NET, and Visual C++ .NET. The two languages most commonly used in .NET are Visual Basic .NET and C#. Other languages that have been ported over to .NET include COBOL, Eiffel, and PERL. I'll use Visual Basic .NET throughout this article.
As is the case with just about every new development environment, you're going to need to be aware of a few new file extensions in Visual Studio .NET.
lists common file extensions that ASP.NET uses.
Table 2: Common ASP.NET file extensions.
Set Up and Installation
ASP.NET page file
ASP.NET User Control file
Web service file
Visual Basic .NET code file for an ASP.NET page
C# code file for an ASP.NET page
Visual Studio .NET Solution file
In order to run ASP.NET Web Forms you need to have Internet Information Server (IIS) and the .NET Framework Software Development Kit (SDK) installed on your machine (installing IIS is beyond the scope of this article).
Notice I didn't say you need Visual Studio .NET installed on your machine to build and run ASP.NET Web Forms. Just like standard HTML, you can create your ASP.NET Web Forms in any text editor. However, we'll use Visual Studio .NET as the development environment.