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 WadjeTOP 100Posted May 6, 2015, 4:03 AM EDT
thanks Swapnal Chonkar sir
Vithal WadjeTOP 100Posted Mar 24, 2015, 8:49 AM EDT
Thanks Swapnal Chonkar sir
Vithal WadjeTOP 100Posted Mar 24, 2015, 8:49 AM EDT
Thanks KP Singh Chundawat sir for your encouraging comment
Swapnal ChonkarPosted Mar 23, 2015, 10:40 PM EDT
Very informative. sir
K P Singh ChundawatPosted Mar 23, 2015, 10:42 AM EDT
One more article from Article factory Name Vithal Wadje ..Good one sir also Knowledgeable
Vithal WadjeTOP 100Posted Mar 23, 2015, 9:22 AM EDT
thanks Manish Kumar Choudhary sir
Manish Kumar ChoudharyPosted Mar 23, 2015, 3:27 AM EDT
Very helpful. Thanks for sharing.