Anatomy of an ASP.NET Application

ASP.NET applications are generally divided into multiple Web pages. Every Web page in an ASP.NET application shares a common set of resources and configuration settings.

Each ASP.NET application is executed inside a separate application domain. These application domains ensure that even if a Web application causes a fatal error, it does not affect other applications that are currently running on the same computer.

Each Web application is a separate entity that has its own set of data. It can be described as a combination of files, pages, handlers, modules, and executable code that can be invoked from a virtual directory on a Web server.

Directories Used in ASP.NET Web Applications:

Bin: Stores all the compiled .NET components (DLLs) that an ASP.NET Web application uses.

App_Code: Stores source code files that are dynamically compiled to be used in the Web application.

App_Browsers: Stores browser definition files.

App_GlobalResources: Stores global resources that are accessible to every page in the Web application.

App_LocalResources: Stores .resx files that are accessible to a specific page only.

App_WebReferences: Stores references to Web services that are used by the Web application.

App_Data: Stores data such as database files and XML files that are used by the application.

App_Themes: Stores the themes that are used in the Web application.

Files used in ASP.NET Web Applications:

Ends with .aspx: These are ASP.NET Web pages that contain the user interface and, optionally, the underlying code.

Ends with .ascx: These are ASP.NET user controls.

Ends with .asmx: These are ASP.NET Web Services.

web.config: This is the XML-based configuration file for ASP.NE applications.

Global.asax: This is the global application file.

Ends with .cs: These are code-behind files that contain C# code.

Ends with .ashx: These are default HTTP handlers for all Web handlers that do not have a user interface.

Configuration Files used in ASP.NET Web Applications:

A configuration file is an XML file that contains configuration settings for an application and has a .config extension.

It provides the following benefits:

    1. Provides control and flexibility over the way you run applications.

    2. Eliminates the need to recompile the application every time a setting changes.

    3. Controls access to protected resources and the location of remote applications and objects by defining configuration settings.

Server Settings - Machine.config - Present at the root of the configuration hierarchy.

Root Web settings - Web.config - Present in the same directory as machine.config.

Website settings (optional) - Web.config - Present in the root directory of each IIS website.

Application root settings (optional) - Web.config - Present in the root directory of each application.

Application subfolder (optional) - Web.config - Present in a subfolder of the application root.

HOME ASP.NET NEXT PREVIOUS