Skip to main content

Page Directives in ASP.NET

Page directives configure the runtime environment that will execute the page. The complete list of directives is as follows:
  1. @ Page - Defines page-specific attributes used by the ASP.NET page parser and compiler and can be included only in .aspx files.
  2. @ Register - Associates aliases with namespaces and classes, which allow user controls and custom server controls to be rendered when included in a requested page or user control.
  3. @ Assembly - Links an assembly to the current page or user control declaratively. 
  4. @ Control - Defines control-specific attributes used by the ASP.NET page parser and compiler and can be included only in .ascx files (user controls).
  5. @ Implements - Indicates that a page or user control implements a specified .NET Framework interface declaratively. 
  6. @ Import - Imports a namespace into a page or user control explicitly.
  7. @ Master - Identifies a page as a master page and defines attributes used by the ASP.NET page parser and compiler and can be included only in .master files.
  8. @ MasterType - Defines the class or virtual path used to type the Master property of a page.
  9. @ OutputCache - Controls the output caching policies of a page or user control declaratively.
  10. @ PreviousPageType - Creates a strongly typed reference to the source page from the target of a cross-page posting.
  11. @ Reference - Links a page, user control, or COM control to the current page or user control declaratively.

Comments