|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
ASP.NET Web Site Layout
You can keep your Web site's files in any folder structure that is convenient for your application. To make it easier to work with your application, ASP.NET reserves certain file and folder names that you can use for specific types of content.
You can establish default pages for your application, which can make it simpler for users to navigate to your site. The default page is the page that is served when users navigate to your site without specifying a particular page. For example, you can create a page named Default.aspx and keep it in your site's root folder. When users navigate to your site without specifying a particular page (for example, http://www.contoso.com/) you can configure your application so that the Default.aspx page is requested automatically. You can use a default page as the home page for your site, or you can write code in the page to redirect users to other pages.
In Internet Information Services (IIS), default pages are established as properties of your Web site.
ASP.NET recognizes certain folder names that you can use for specific types of content. The table below lists the reserved folder names and the type of files that the folders typically contain.
The content of application folders, except for the App_Themes folder, is not served in response to Web requests, but it can be accessed from application code.
Contains browser definitions (.browser files) that ASP.NET uses to identify individual browsers and determine their capabilities. For more information, see Browser Definition File Schema (browsers Element) and How to: Detect Browser Types in ASP.NET Web Pages.
Contains source code for utility classes and business objects (for example, .cs, .vb, and .jsl files) that you want to compile as part of your application. In a dynamically compiled application, ASP.NET compiles the code in the App_Code folder on the initial request to your application. Items in this folder are then recompiled when any changes are detected.
Arbitrary file types can be placed in the App_Code folder to create strongly typed objects. For example, placing Web service files (.wsdl and .xsd files) in the App_Code folder creates strongly typed proxies.
Code in the App_Code folder is referenced automatically in your application. In addition, the App_Code folder can contain subdirectories of files that need to be compiled at run time. For more information, see Shared Code Folders in ASP.NET Web Sites and codeSubDirectories Element for compilation (ASP.NET Settings Schema).
Contains application data files including MDF files, XML files, as well as other data store files. The App_Data folder is used by ASP.NET 2.0 to store an application's local database, which can be used for maintaining membership and role information. For more information, see Introduction to Membership and Understanding Role Management.
Contains resources (.resx and .resources files) that are compiled into assemblies with global scope. Resources in the App_GlobalResources folder are strongly typed and can be accessed programmatically. For more information, see ASP.NET Web Page Resources Overview.
Contains resources (.resx and .resources files) that are associated with a specific page, user control, or master page in an application For more information, see ASP.NET Web Page Resources Overview.
Contains a collection of files (.skin and .css files, as well as image files and generic resources) that define the appearance of ASP.NET Web pages and controls. For more information, see ASP.NET Themes and Skins Overview.
Contains reference contract files (.wsdl files), schemas (.xsd files), and discovery document files (.disco and .discomap files) defining a Web reference for use in an application. For more information about generating code for XML Web services, see Web Services Description Language Tool (Wsdl.exe).
Contains compiled assemblies (.dll files) for controls, components, or other code that you want to reference in your application. Any classes represented by code in the Bin folder are automatically referenced in your application. For more information, see Shared Code Folders in ASP.NET Web Sites.
Configuration settings for your site are managed in a Web.config file that is located in the site's root folder. If you have files in subfolders, you can maintain separate configuration settings for those files by creating a Web.config file in that folder.
You cannot set or override configuration settings at the subfolder level if they apply to the site as a whole.
For more information, see Administering ASP.NET Web Sites.
Restricting Access to Site Content
As part of the site's configuration, you can configure settings that restrict access to either individual files or subfolders. You can restrict content by individuals or by roles (groups). For details, see Managing Authorization Using Roles.