Share via


Layout of ASP.NET Web Applications

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1

An ASP.NET application must reside in an IIS virtual directory, known as the application root. ASP.NET applications can contain compiled assemblies (usually DLL files that contain business logic); a well-known directory, always named \Bin, where precompiled code is stored; configuration settings stored in a text-based, human-readable Web.config file; pages; server controls; and XML Web services.

Any precompiled code that is not shared with other applications on the server must be stored in the application's \Bin directory. This is the local assembly cache for the application.

Note

If you intend to use the same assembly in multiple applications on your Web server, you should deploy that assembly to the global assembly cache. For more information, see Deploying Shared Components to the Global Assembly Cache.

Web.config files store application-wide configuration settings in an XML-based text file. This means that you can use any standard text editor or XML parser to create them, and that they are readable. If you do not include a Web.config file in the application root, configuration settings are determined by those set in the Machine.config file, the configuration file for the entire server. A version of the Machine.config file is installed when you install the .NET Framework. For more information about configuration files, see Overview of ASP.NET Configuration.

The following illustration shows a sample file system layout for an ASP.NET application.

Art Image

The application in this illustration includes two DLL files in the \Bin directory, a Default.aspx page, a user control named Menu.ascx, an XML Web service named MyWebService.asmx, and a Global.asax file. In addition, the application is configured using three configuration files: the machine-level Machine.config file in the system root directory, the site-level Web.config file in the C:\Inetpub\Wwwroot directory, and the application-level Web.config file in the application root directory. Configuration settings stored in the application root override the settings in the site's Web.config file and the Machine.config file, while the site's Web.config file overrides settings in the Machine.config file.

Note

ASP.NET applications are composed of virtual directory structures, not physical directory structures. Configuration settings are applied to virtual paths.