Application Settings Files

ASP.NET applications can be configured through two different file-based mechanisms:

  • global.asax— Global application setting file.

  • web.config— XML-based application configuration file.

The global.asax File

The global.asax file has two main purposes:

  • To enable you to define application- and session-wide variables, objects, and data.

  • To enable you to define event handlers for application- and session-based events that happen in the scope of the application.

Directives Used in the global.asax File

The global.asax file can include the following possible elements:

  • The @Assembly directive— Is used to register a compiled assembly with the web application; another way to register assemblies is to use the web.config file, ...

Get Inside ASP.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.