I think their verbiage is a little confusing. You are correct that the values within the directive are essentially properties. In fact, you can set most of these AS properties within the object model (e.g. in the codebehind).
protected override void OnInit( EventArgs e )
{
this.EnableViewState = true;
this.MasterPageFile = "~/something.master";
this.Title = "Hello World";
}
Their are several important directives besides Page
, such as Import
and Control
. I would suggest being familiar with these as well.
EDIT: I was curious where these attributes end up when set from the Page directive, so I took a look at the ASP.Net cache. As you probably know, when a page is executed it is turned into an object and cached on the file system in:
c:\windows\Microsoft.Net\Framework[version]\Temporary ASP.Net Files\
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private void @__BuildControlTree(content_shared_toolbarcontrol_ascx @__ctrl) {
System.Web.UI.IParserAccessor @__parser = ((System.Web.UI.IParserAccessor)(@__ctrl));
#line 1 "C:\dev\Web.UI\Content\Shared\ToolbarControl.ascx"
@__parser.AddParsedSubObject(new System.Web.UI.LiteralControl("\r\n<div class=\"toolbar\">\r\n "));
#line default
#line hidden
global::System.Web.UI.HtmlControls.HtmlGenericControl @__ctrl1;
#line 1 "C:\dev\Web.UI\Content\Shared\ToolbarControl.ascx"
@__ctrl1 = this.@__BuildControldivDelete();
#line default
#line hidden
#line 1 "C:\dev\Web.UI\Content\Shared\ToolbarControl.ascx"
@__parser.AddParsedSubObject(@__ctrl1);
#line default
#line hidden
#line 1 "C:\dev\Web.UI\Content\Shared\ToolbarControl.ascx"
@__parser.AddParsedSubObject(new System.Web.UI.LiteralControl("\r\n <div class=\"toolbarSpacer\"></div>\r\n <div class=\"toolbarButton\">"));
et cetera
What I found interesting is that properties such as one might set in the Page directive are not included in these auto-generated files. This leads me to believe that the directive in its completeness is processed on each request and is not compiled along with the page.
EDIT #2: Per BurningIce's comment below, I dug into this further. I believe directive attributes can be described as follows.
Each of the attributes on a directive serves one or more of the following purposes: A hint to the compiler (such as the codebehind path), a hint to load the page (such as what class the page inherits from), a hint to render the page (such as MasterPageFile), and/or a property to set on each instance of the page that is created (such as Title).