About Links Archives Search Feed Albums of Note


ASP.NET 4.0, Part 6: New Page Directive Attributes

Welcome to part 6 of my tour through ASP.NET 4.0 [http://blog.hmobius.com/post/2010/02/09/ASPNET-40-Cometh.aspx]. Over the next few posts we’ll be looking at some of the changes made to the standard webforms page. For today, we’ll start at the top and look at the new Page directive attributes in this release in anticipation of some future posts.

The default @Page directive added to the top of every new webform generated by Visual Studio 2010 has not changed from that in VS2008. It still has the standard four attributes.

<%@ Page Language=“C#” AutoEventWireup=“true” CodeFile=“Default.aspx.cs” Inherits="_Default" %>

Indeed, all 42 (yes, 42!) attributes from .NET 2.0 have been kept for backwards compatibility as you might expect.  You might be surprised how many there are: some present per-page overrides to the element in your web.config files, others how the page should operate, and others how the code-behind the page fits into the code hierarchy of your site. A brief explanation of them all can be found here [http://msdn.microsoft.com/en-gb/library/ydy4x04a(lightweight).aspx].

ASP.NET 4.0 brings with it six new attributes for the @Page directive, as follows:

In tomorrow’s post, we’ll look in more depth at the new options for controlling ViewState on a page. Happy coding!

Posted on February 22, 2010   #Geek Stuff  






← Next post    ·    Previous post →