Directives define the page configuration and properties that decide how the page will be processed. If the directives are not defined at the page level then the setting is inherited from web.config or machine.config file.
Assembly
- Name
- Src
- <%@ Assembly Name="assemblyname" Src="SourceofAssembly.dll"%>
- Interface
- <%@ Implements Interface="InterfaceName"%>
- Namespace
- <%@ Import CodeFile="~/Default.aspx.cs" ClassName="" Inherits="" Language="C#"%>
The MasterType directive creates a strongly typed reference to the ASP.NET master page when the master page is accessed from the Master property. It has the following attributes:
- TypeName
- VirtualPath
- <%@MasterType TypeName="Name" VirtualPath="virtualPathofFile"%>
- Duration
- Location
- ServerAndClient
- Shared
- VaryByControl
- VaryByCustom
- VaryByHeader
- VaryByParam
- VaryByContentEncoding
- CacheProfile
- NoStore
- SqlDependency
- ProviderName
- <%@OutPutCache CacheProfile="ProFileName" Duration="defineduration" SqlDependency="definedependency" %>
- Async
- AsyncTimeOut
- AspCompat
- AutoEventWireup
- Buffer
- ClassName
- ClientIDMode
- ClientTarget
- CodeBehind
- CodeFile
- CodeFileBaseClass
- CodePage
- CompilationMode
- CompilerOptions
- ContentType
- Culture
- Debug
- Description
- EnableSessionState
- EnableTheming
- EnableViewState
- EnableViewStateMac
- ErrorPage
- Explicit
- Inherits
- Language
- LCID
- LinePragmas
- MaintainScrollPositionOnPostback
- MasterPageFile
- MetaDescription
- MetaKeywords
- ResponseEncoding
- SmartNavigation
- Src
- Strict
- StyleSheetTheme
- TargetSchema
- Theme
- Title
- Trace
- TraceMode
- Transaction
- UICulture
- ValidateRequest
- ViewStateEncryptionMode
- ViewStateMode
- WarningLevel
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
The PreviousPageType directive defines the Previous Page reference and access the properties of the child page. It has the following attributes:
- TypeName
- VirtualPath
- <%@PreviousPageType TypeName="TyepOfFile" VirtualPath="PathOfTheFile"%>
- Control
- PageVirtual
- Path
- <%@Reference Control="UrlOfControl" Page="PageUrl" VirtualPath="VirtualpathOfFile"%>
- Assembly
- Namespace
- Src
- TagName
- TagPrefix
- <%@Register Assembly="assemblyName" Namespace="NameSpaceFile" Src="SourceFileUrl" TagName="TagName" TagPrefix="Prefix"%>
- AutoEventWireup
- CodeFile
- CompilationMode
- CompilerOptions
- Debug
- Description
- EnableTheming
- EnableViewState
- Explicit
- Inherits
- Language
- LinePragmas
- MasterPageFile
- Src
- Strict
- WarningLevel
- <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
The Control directive is used for user control configuration. It has the following attributes:
- AutoEventWireup
- ClassName
- ClientIDMode
- CodeBehind
- CodeFile
- CodeFileBaseClass
- CompilationMode
- CompilerOptions
- Debug
- Description
- EnableTheming
- EnableViewState
- Explicit
- Inherits
- Language
- LinePragmas
- Src
- Strict
- TargetSchema
- WarningLevel
- <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>
- For the detailed practical approach, create sample pages using the preceding directives.

Vithal WadjePosted May 6, 2015, 8:03 AM
thanks Swapnal Chonkar sir
Vithal WadjePosted Mar 24, 2015, 12:49 PM
Thanks Swapnal Chonkar sir
Vithal WadjePosted Mar 24, 2015, 12:49 PM
Thanks KP Singh Chundawat sir for your encouraging comment
Swapnal ChonkarPosted Mar 24, 2015, 2:40 AM
Very informative. sir
K P Singh ChundawatPosted Mar 23, 2015, 2:42 PM
One more article from Article factory Name Vithal Wadje ..Good one sir also Knowledgeable
Vithal WadjePosted Mar 23, 2015, 1:22 PM
thanks Manish Kumar Choudhary sir
Manish Kumar ChoudharyPosted Mar 23, 2015, 7:27 AM
Very helpful. Thanks for sharing.