Structure of an ASP.NET Application

Structure of an ASP.NET Application

A logical way to begin a chapter on ASP.NET applications is to define the term ASP.NET application. An ASP.NET application consists of all the files in a virtual directory and its subdirectories. If your Web server has a subdirectory named MyApp and MyApp is a virtual directory, all the files in MyApp and any subdirectories that stem from it make up an ASP.NET application. Typically, an application includes one or more of the following file types:

  • ASPX files containing Web forms

  • ASCX files containing user controls

  • Web.config files containing configuration settings

  • A Global.asax file containing global application elements

  • DLLs containing custom types employed by the application

An application can contain an unlimited number of ASPX and ASCX files, each representing a different Web page or portion of a page. Only one Global.asax file is permitted. The number of Web.config files isn t restricted, but each must reside in a different directory. ASP.NET places no limit on the number of DLLs an application uses. DLLs are normally found in the application root s bin directory.

Figure 9-1 diagrams the physical structure of a very simple ASP.NET application that consists of a lone Web form in an ASPX file. The directory containing the ASPX file has been transformed into a virtual directory with the IIS configuration manager and is therefore URL-addressable on the server.

Figure 9-1

A simple ASP.NET application.

Figure 9-2 depicts an ASP.NET application that s more representative of those found in the real world. The virtual directory at the top of the directory hierarchy (the application root ) houses several ASPX files, each representing a single page in the application, as well as ASCX files containing user controls. It also holds a Global.asax file containing event handlers and other elements that are global to the application. Underneath the virtual root is a pair of subdirectories containing ASPX files of their own. Each directory contains a Web.config file containing configuration information for the file or files in that directory. Inside the virtual root s bin subdirectory are DLLs containing code-behind classes, custom controls, and other custom types used by the application.

Figure 9-2

A more complex ASP.NET application.



Programming Microsoft  .NET
Applied MicrosoftNET Framework Programming in Microsoft Visual BasicNET
ISBN: B000MUD834
EAN: N/A
Year: 2002
Pages: 101

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net