Asp.net page Directives

Asp.net Page Directive(Directives and Page Properties)in Asp.net:



In Asp.net the page directives is a work as instructions to specify the optional setting.  Registering a page language and custom control.  These are setting using how in Asp.net web page (.aspx) and user control (.ascx) pages in .net frame work.

The Syntax use a page directivein asp.net is:-

<%@ directive {attribute=value} * %>

Page directives are started with the @page directive (for a page). 

Some directives in asp.net are there is:

  • @Page
  • @Control
  • @Import
  • @Implements
  • @Register
  • @Assembly
  • @Master
  • @PreviousPage Type
  • @MasterType
  • @OutputCache
  • @Reference

Here we explain one by one.

Asp.net page Directives
Directives

Other page directive Related Questions :

  • What is the page directive in asp.net.
  • Asp net page directive validate request.
  • Inherits in page directive asp net.
  • Asp net master page directive.
  • Asp net enable session state page directive.
  • Previous page directive in asp net. 

The @Page Directive:

It defines the page specific attributes using by .net page parser and Compiler.

Syntax: - <%@ Page attribute=”value” [ attribute=”value”……] %>

The @Control Directive:

It is Defines the control specific attributes by .net page parser and Compiler. It is used only in aspx files.

Syntax: - <%@ Control attribute=”value” [ attribute=”value”……] %>

The @Import Directive:

It is defines that explicitly imports a namespace into .net application. Web page, master page user control page and the global.aspx file.

Syntax: - <%@ Import namespace=”value” %>

The @Implements Directive:

It indicates that web page, master page and User control page must be implement .net interface.

Syntax: - <%@ Implements interface=”validInterfaceName” %>

The @Register Directive:

It is creates an association of two tag prefix and custom control in .net web pages.

Syntax: -
 <%@ Register tagprefix =”tagprefix” namespace=”namespace” assembly=”assembly” %>

The @Assembly Directive:

The Assembly is providing links to the .net applications files such as master page, user control and Global.aspx and Web Page. It is also help in creating all interfaces and classes.

Syntax: - 

<%@ Assembly Name=”assemblyname” %>
<@%Assembly Src=”pathname” %>

The @Master Directive:

It is defines the attribute of a master page (.master file).

Syntax: - <%@Master attribute=”value” [ attribute=”value”……] %>

The @PreviousPageType Directive:

Its provides the strong typing against the previous page.

Syntax: - <%@ PreviousPageType attribute=”value” [ attribute=”value”……] %>

The @MasterType Directive:

It provides the reference to the asp.net master page and accessed the master page property.

 Syntax: - <%@ MasterType attribute=”value” [ attribute=”value”……] %>

The @OutputCache Directive:

It is a controls output of caching policies of web page..

Syntax: - <%@ OutputCache Duration=”#ofseconds” Location=”Any|client|Downstream|server|None|ServerAndClient”
Shared=True | False” %>

The @Reference Directive:

It provides the user control and web page file at the virtual path.

Syntax: -
 <%@ Reference Page =”path to .aspx page” Control=”path to .ascx file” VirtualPath=”path to file” %>


Asp.net Related Other Post:


Comments