共用方式為


ASP.NET Web Project File Types

Web site applications can contain different file types. By default, some are supported and managed by ASP.NET, and others are supported and managed by the IIS server. Optionally, you can specify that all types should be handled by ASP.NET.

Most of the ASP.NET file types can be automatically generated using the Add New Item menu item in Visual Studio.

File types are associated with applications by using mappings. For example, if you double-click a .txt file in Windows Explorer, typically Notepad opens, because in Windows, .txt file types are associated by default to Notepad.exe. In Web applications, file types are mapped to application extensions in IIS. For more information, see Setting Application Mappings or Configuring Application Settings in IIS 7 on the Microsoft TechNet Web site.

File Types Managed by ASP.NET

File types that are managed by ASP.NET are mapped to the Aspnet_isapi.dll in IIS.

File type

Location

Description

.asax

Application root.

Typically a Global.asax file that represents the application class and contains optional methods (event handlers) that run at various points in the application life cycle. For more information, see Global.asax Syntax.

.ascx

Application root or a subdirectory.

A Web user control file that defines a custom functionality that you can add to any ASP.NET Web Forms page. For more information, see ASP.NET User Controls.

.ashx

Application root or a subdirectory.

A handler file that is invoked in response to a Web request in order to generate dynamic content. For more information, see HTTP Handlers and HTTP Modules Overview.

.asmx

Application root or a subdirectory.

An XML Web services file that contains classes and methods that can be invoked by other Web applications. For more information, see ASP.NET Web Services.

.aspx

Application root or a subdirectory.

An ASP.NET Web Forms page that can contain Web controls and presentation and business logic. For more information, see ASP.NET Web Forms Pages and ASP.NET Web Server Controls Overview.

.axd

Application root.

A handler file that is used to manage Web site administration requests, such as Trace.axd. For more information, see ASP.NET Tracing Overview.

.browser

App_Browsers subdirectory.

A browser definition file that identifies the features of an individual browser. For more information, see ASP.NET Web Server Controls and Browser Capabilities.

.cd

Application root or a subdirectory.

A class diagram file.

Working with Class Diagrams (Class Designer)

.compile

Bin subdirectory.

A precompiled stub file that points to an assembly that represents a compiled Web site file. When you precompile a Web site project, executable file types (.aspx, ascx, .master, and theme files) are compiled and put in the Bin subdirectory. For more information, see ASP.NET Web Site Project Precompilation Overview.

.config

Application root or a subdirectory.

A configuration file contains XML elements that represent settings for ASP.NET features. For more information, see ASP.NET Configuration Files.

.cs, .vb

App_Code subdirectory, or in the case of a code-behind file for an ASP.NET page, in the same directory as the Web page.

Source code files (.cs or .vb files) that define code that can be shared between pages, such as code for custom classes, business logic, HTTP modules, and HTTP handlers.

.csproj, .vbproj

Visual Studio project directory.

A project file for a Visual Studio Web-application project.

.disco, .vsdisco

App_WebReferences subdirectory.

An XML Web services discovery file that is used to help locate Web services. For more information, see ASP.NET Web Services.

.dsdgm, .dsprototype

Application root or a subdirectory.

A distributed service diagram (DSD) file that can be added to any Visual Studio solution that provides or consumes Web services to reverse-engineer an architectural view of the Web service interactions. For more information, see ASP.NET Web Services.

.dll

Bin subdirectory.

A compiled class library file (assembly). In a Web site project, instead of placing compiled assemblies in the Bin subdirectory, you can put source code for classes in the App_Code subdirectory. For more information, see Shared Code Folders in ASP.NET Web Site Projects.

.licx, .webinfo

Application root or a subdirectory.

A license file. Licensing allows control authors to help protect intellectual property by checking that a user is authorized to use the control. For more information, see How to: License Components and Controls.

.master

Application root or subdirectory.

A master page that defines the layout for other Web pages in the application. For more information, see ASP.NET Master Pages.

.mdb, .ldb

App_Data subdirectory.

An Access database file. For more information, see ASP.NET Data Access Content Map.

.mdf

App_Data subdirectory.

A SQL Server Express database file. For more information, see ASP.NET Data Access Content Map.

.msgx, .svc

Application root or a subdirectory.

An Indigo Messaging Framework (MFx) service file.

.resources, .resx

App_GlobalResources or App_LocalResources subdirectory.

A resource file that contains resource strings that refer to images, localizable text, or other data. For more information, see Resources in Desktop Apps or How to: Create Resource Files for ASP.NET Web Sites.

.sdm, .sdmDocument

Application root or a subdirectory.

A system definition model (SDM) file.

.sitemap

Application root.

A sitemap file that defines the logical structure of the Web application. ASP.NET includes a default sitemap provider that uses sitemap files to display a navigational control in a Web page. For more information, see ASP.NET Site Navigation.

.skin

App_Themes subdirectory.

A skin file that contains property settings to apply to Web controls for consistent formatting. For more information, see ASP.NET Themes and Skins.

.sln

Visual Studio project directory.

A solution file for a Visual Studio project.

.soap

Application root or a subdirectory.

A SOAP extension file.

File Types Managed by IIS

The following file types are typically managed by IIS.

File type

Location

Description

.asa

Application root.

Typically a Global.asa file that contains optional methods that run at the start or end of the ASP session or application lifetime. For more information, see Global.asa Syntax in the IIS SDK.

imDitto

Application root or a subdirectory.

An ASP Web page that contains @ directives and script code that uses the ASP built-in objects. For more information, see IIS ASP Scripting Reference in the IIS SDK.

.cdx

App_Data subdirectory.

A compound index file structure file for Visual FoxPro. For more information, see Compound Index File Structure in MSDN.

.cer

Application root or a subdirectory.

A certificate file used to authenticate a Web site. For more information, see Certificates in the IIS Operations Guide.

.idc

Application root or a subdirectory.

An Internet Database Connector file mapped to httpodbc.dll.

Note

IDC has been deprecated because it does not provide enough security for data connections. IIS 6.0 is the last version to include IDC.

.shtm, .shtml, .stm

Application root or a subdirectory.

Mapped to ssinc.dll. For more information, see IIS Server-Side Include Directives in the IIS SDK.

Static File Types

IIS serves static files only if their file-name extensions are registered in the MIME types list. This list is stored in the MimeMap IIS metabase property for an application. If a file type is mapped to an application extension, it does not need to be included in the MIME types list unless you want the file to be treated like a static file. Typically, ASP.NET source code file types should not be in the MIME types list because that will allow browsers to view the page's source code.

The following table lists only a few of the registered file types.

File type

Location

Description

.css

Application root or subdirectory, or App_Themes subdirectory.

Style sheet files used to determine the formatting of HTML elements.

.htm, .html

Application root or subdirectory.

Static Web files written in HTML code.

See Also

Concepts

ASP.NET Web Site Project Precompilation Overview

Other Resources

ASP.NET Web Projects

Web Application Projects versus Web Site Projects in Visual Studio