Different types of Dot Net Directives
Dot net has reusable, customizable solutions for larger programming tasks. Dot Net Directives are responsible for any kind of change in the settings that decide the actions of an entire page. They are language specific and for .NET they function as settings of the parser and compiler. They can be used anywhere in a page, but in most of the cases it is best to use them in the beginning of the page for best results. Directives are used in both .aspx files (ASP.NET pages) and .ascx files (user control pages).
The following are the types of Dot net directives:
The page directive of dot net defines page-specific attributes used by the ASP.NET page parser and compiler. It can be included only in .aspx files and also define the page language used just like c#,VB etc.
The Control directive of dot net defines control-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .ascx files. The Control directive also defines the view state of page.
The Import directive of dot net clearly imports a namespace into a page or user control. The Import directive cannot have more than one namespace attribute. To import multiple namespaces, use multiple @Import directives. Thus import directive helps in importing of files.
Indicates that the current page or user control implements the specified .NET framework interface.
Associates aliases with namespaces and class names for concise notation in custom server control syntax. We can register the user control also with the help of Register directive.
The Assembly directive links an assembly to the current page during compilation, making all the assembly’s classes and interfaces available for use on the page.
Declaratively controls the output caching policies of an ASP.NET page or a user control contained in a page
Declaratively indicates that another user control or page source file should be dynamically compiled and linked against the page in which this directive is declared.