To create the simple Web Form that will be used in the next example, start up Visual Studio .NET and select File → New Web Site . In the New Web Site menu , choose C# as your language, and choose ASP.NET Web Site as the template to use. Finally, locate your web site somewhere on your disk (at the bottom of the dialog), as shown in Figure 19-1.
Figure 19-1. Creating a new web site
Visual Studio creates a folder named Learning C Sharp Web in the
directory you’ve indicated, and within that directory, it creates your
Default.aspx page (for the User
your code), and a Data directory (currently empty, but often used to
hold data files).
Code-behind is the default coding model used by Visual
Studio 2005. When a new web site is created, Visual Studio
automatically creates two files: the content file, with a default
name, such as
Default.aspx, and a
code-behind file with a matching name, such as
Default.aspx.cs (assuming you are using C#
as your programming language). If you change the name of the content
file (highly recommended), the code-behind file will automatically
assume the new name.
ASP.NET 1.1 programmers take note: the
code-behind model for ASP. NET has changed. In Versions 1.0, the
code-behind file defined a class that derived from
Page. This code-behind class contained instance variables for all the controls ...