Condividi tramite


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.

Default Pages

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, https://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.

Note

In Internet Information Services (IIS), default pages are established as properties of your Web site.

Application Folders

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.

Note

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.

Folder

Description

App_Browsers

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.

App_Code

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.

Note

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).

App_Data

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.

App_GlobalResources

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.

App_LocalResources

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.

App_Themes

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.

App_WebReferences

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).

Bin

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.

Managing Subfolders

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.

Note

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.

See Also

Tasks

How to: Create Web.config Files

Concepts

Shared Code Folders in ASP.NET Web Sites

ASP.NET Web Site Paths

ASP.NET Themes and Skins Overview

ASP.NET Web Page Resources Overview