Being More Professional about Referring to ASP.NET Web Forms

A recent job interview with a very, very interesting company in Marina Del Rey, gave me the opportunity to review my way of approaching ASP.NET Web Forms. My way of approaching ASP.NET Web Forms in a professional conversation is deliberately disruptive and easily offensive. I want to offend “thought leaders” in Microsoft IT shops that may claim to appreciate jQuery and ASP.NET MVC but they actually do not and would actually prefer to work within the theory behind ASP.NET Web Forms. I don’t want to have a bait-and-switch kind of work-day-hell situation where I’m hired for an ASP.NET MVC/jQuery future but stuck in an ASP.NET Web Forms present. Simultaneously, I am willing to work with ASP.NET Web Forms as long as it is clear to me that no religious affections for Web Forms coming from the culture of the shop.

One red flag signifying such 1990s-based religious fervor is a request from an interviewer asking me to recite, from memory, the ASP.NET Page lifecycle and/or the IIS application lifecycle. Too many Microsoft shops use these rote memorization stunts as intelligence tests—and I have always been disgusted with such mis-measurements. But my disgust has prevented me from really thinking about an authentic response to this question that is respectful of my principles/theories and not ‘easily’ offensive to my inquisitors.

Instead of memorizing this from ASP.NET 2.0:

Application: BeginRequest
Application: PreAuthenticateRequest
Application: AuthenticateRequest
Application: PostAuthenticateRequest
Application: PreAuthorizeRequest
Application: AuthorizeRequest
Application: PostAuthorizeRequest
Application: PreResolveRequestCache
Application: ResolveRequestCache
Application: PostResolveRequestCache
Application: PreMapRequestHandler
Page: Construct
Application: PostMapRequestHandler
Application: PreAcquireRequestState
Application: AcquireRequestState
Application: PostAcquireRequestState
Application: PreRequestHandlerExecute
Page: AddParsedSubObject
Page: CreateControlCollection
Page: AddedControl
Page: AddParsedSubObject
Page: AddedControl
Page: ResolveAdapter
Page: DeterminePostBackMode
Page: PreInit
Control: ResolveAdapter
Control: Init
Control: TrackViewState
Page: Init
Page: TrackViewState
Page: InitComplete
Page: LoadPageStateFromPersistenceMedium
Control: LoadViewState
Page: EnsureChildControls
Page: CreateChildControls
Page: PreLoad
Page: Load
Control: DataBind
Control: Load
Page: EnsureChildControls
Page: LoadComplete
Page: EnsureChildControls
Page: PreRender
Control: EnsureChildControls
Control: PreRender
Page: PreRenderComplete
Page: SaveViewState
Control: SaveViewState
Page: SaveViewState
Control: SaveViewState
Page: SavePageStateToPersistenceMedium
Page: SaveStateComplete
Page: CreateHtmlTextWriter
Page: RenderControl
Page: Render
Page: RenderChildren
Control: RenderControl
Page: VerifyRenderingInServerForm
Page: CreateHtmlTextWriter
Control: Unload
Control: Dispose
Page: Unload
Page: Dispose
Application: PostRequestHandlerExecute
Application: PreReleaseRequestState
Application: ReleaseRequestState
Application: PostReleaseRequestState
Application: PreUpdateRequestCache
Application: UpdateRequestCache
Application: PostUpdateRequestCache
Application: EndRequest
Application: PreSendRequestHeaders
Application: PreSendRequestContent

My “over-idealistic” principles lead me to know these points:

  • The ASP.NET Web Forms Page lifecycle consists of events that primarily allow granular control over Server Controls.
  • The ASP.NET Web Forms Application lifecycle consists of events that primarily allow control over security Authentication and Authorization.

It follows that any ignorance I might have about these lifecycles implies that:

  • I am inexperienced with using Server Controls—especially implementing custom controls.
  • I am inexperienced with using View State.
  • I am inexperienced with using advanced security scenarios with ASP.NET—especially implementing ASP.NET Membership/Roles/Profiles.

What too many Web Forms people sitting across from me in an interview don’t care to respect is that my inexperience with Server Controls and View State is by design. However, my lack of experience with ASP.NET Membership/Roles/Profiles is a sad consequence of my deliberate de-prioritizing Server Controls and View State. My career-level decision to essentially defer learning about these features of ASP.NET in order to go into ASP.NET MVC is the right future-focused strategy—no amount of sophomoric snickering will change that—but to get a job in the present I need to know a little more about the older, more proprietary features of ASP.NET.

Joe Stagner Actually Talks about ASP.NET Page Lifecycle

Instead of listing a bunch of events or showing a colorful poster of events, Joe Stagner of Microsoft actually talks about the ASP.NET Page lifecycle. When one is “forced” to talk about this subject, it becomes more human—therefore more relevant. Here are some points gleaned from Joe’s talk:

  • It may be best to classify Page events into three groups: Init, Load and Render.
  • The Init and Load event ‘groupings’ are divided into three logical granules PreEvent, Event and EventComplete. For example the Init grouping is PreInit, Init and InitComplete.
  • One important Application-level stage in ASP.NET is getting Request state (AcquireRequestState) where the Page.Request (and, according to Joe, the Page.Response) object is instantiated. Also, according to Joe, the Page.IsPostBack property is set here.
  • During PreInit, there is no View State set yet.
  • During PreInit, any dynamic server controls or master pages can be instantiated here. Any profile/theme properties can be set here.
  • Joe makes a point to mention that during the Init event, the Control.Init event fires for each child Control of the Page.
  • The InitComplete event is a granular opportunity to handle any View State issues. From the documentation: “Use this event to make changes to view state that you want to make sure are persisted after the next postback.”
  • The PreLoad event represents the time when View State is reconstituted (so it has a logical relationship with SaveStateComplete which fires at the end of the Page lifecycle).
  • The LoadComplete event is a granular opportunity to handle any communication among child controls.
  • The PreRender event calls EnsureChildControls for the Page and child controls.
  • The PreRenderComplete event is a granular opportunity to handle any data binding issues.
  • The Render event is the obvious one.
  • The Unload event is not so obvious to me—but it should be: this is when the page is just about to be returned to the client so it’s a time for cleanup.

What should be authentically memorable to me is that these lifecycle events are where developers interact with all of the features of ASP.NET. So a developer that has memorized the lifecycle is one who has used almost all of the features of ASP.NET extensively (repeatedly, maybe violating DRY principles)—or just some dude with great memorization skills.

Related Links

Today’s Google Starred Items: “Introducing WebMatrix”

Scott Guthrie presents at MIX10.Scott Guthrie: “The 15MB download includes a lightweight development tool, IIS Express, SQL Compact Edition, and a set of ASP.NET extensions that enable you to build standalone ASP.NET Pages using the new Razor syntax, as well as a set of easy to use database and HTML helpers for performing common web-tasks.  WebMatrix can be installed side-by-side with Visual Studio 2010 and Visual Web Developer 2010 Express.”

“Entity Framework 4 ‘Code-First’: Custom Database Schema Mapping”

Scott Guthrie: “EF4 ‘Code First’ enables you to optionally override its default database persistence mapping rules, and configure alternative ways to map your classes to a database. …The OnModelCreating method above will be called the first time our NerdDinners class is used within a running application, and it is passed a “ModelBuilder” object as an argument.  The ModelBuilder object can be used to customize the database persistence mapping rules of our model objects.  We’ll look at some examples of how to do this below.”

“Introducing IIS Express”

Scott Guthrie: “Visual Studio’s built-in ASP.NET Development Server (also known as ‘Cassini’) has the benefit of being light-weight and easy to quickly run.  It doesn’t listen on remote ports (which makes it easier to get approved for many corporate security environments), works even when you are running under a non-administrator account, and doesn’t require a separate installation step.”

“Visual Studio 2010 Keyboard Shortcuts”

Scott Guthrie: “Earlier this week the Visual Studio team released updated VS 2010 Keyboard Shortcut Posters.  These posters are print-ready documents (that now support standard paper sizes), and provide nice “cheat sheet” tables that can help you quickly lookup (and eventually memorize) common keystroke commands within Visual Studio. ”

“July 9th Links: ASP.NET, ASP.NET MVC, jQuery, Silverlight, WPF, VS 2010”

Scott Guthrie: “Installing and Configuring Windows Server AppFabric and ‘Velocity’ Memory Cache: Scott Hanselman has a nice blog post that describes how to install and configure Windows Server AppFabric – which is a free application server offering from Microsoft.  In less than 10 minutes you can enable its ‘Velocity’ memory cache, and use it within your ASP.NET applications. …Building a Simple Forms Application using the Silverlight Tool for VS 2010 and WCF RIA Services: Mark has a really nice tutorial that walks through how to build a simple data forms application using Silverlight, VS 2010 and WCF RIA Services.”

Magneto, MariaDB, Moblin and other links…

Magneto VintageMagento is an Open Source ecommerce web application launched on March 31, 2008. It was created by Varien, building on components of the Zend Framework. Magento is available under the Open Software License version 3.0. Since version 1.1.7 some parts are licensed under the Academic Free License version 3.0. Magento Enterprise Edition, a paid for version of Magento aimed at larger companies, was launched on April 15, 2009…”

MariaDB

Askmonty.org: “What is the goal of MariaDB? To provide a community developed, stable, and always Free branch of MySQL that is, on the user level, compatible with the main version. We strive for total interoperability with our upstreams and our own community.”

Moblin

Moblin, short for mobile Linux, is an open source project focused on developing software for Mobile Internet Devices (MIDs) and other new categories of devices such as netbooks and nettops. Intel launched the Moblin.org site in July 2007 and significantly updated the site in April 2008 with the launch of the Intel Atom processor family at the Intel Developer Forum in Shanghai. A custom SDK is also available on the site. The Moblin 2 OS was specifically designed to run on an Intel Atom processor in a netbook. In April 2009 Intel turned Moblin over to the Linux Foundation.”

“Why I Switched from Eclipse PDT to NetBeans IDE”

chad: “Regardless of the server-side languages an IDE supports, it must also provide robust support for writing JavaScript. It must also provide support for today’s popular JavaScript frameworks, including dojo, jQuery, and YUI. Currently, Eclipse’s JSDT plugin does not support these libraries… I didn’t need a tutorial to install and configure NetBeans to match my Eclipse environment. NetBeans came with everything I needed out of the box. Here are the hightlights.”

“ASP.NET 4.0 Webforms Enhancements”

Mike Ormond’s Blog: “Yes indeed. Now you can have your cake and eat it—almost. We give you control over the ClientIDs generated by server controls. ASP.NET does an excellent job of avoiding naming conflicts in the HTML document through the use of naming containers that guarantee uniqueness for a certain context. The result though, can be lengthy, complex and (importantly) difficult to predict ClientIDs. …This can make life a misery if you’re doing DOM manipulation in Javascript as you typically revert to some inline code to extract the ClientID. You’ll find littered all over the place. Given the surge in popularity of AJAX and client frameworks like jQuery, the pain caused by this “guarantee of safety” is becoming more acute.”

“ASP.NET 2.0 Tips, Tricks, Recipes and Gotchas”

scottgu: “Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005”; “Tip/Trick: Changing the default browser used in VS 2005 and Visual Web Developer”; “Tip/Trick: Creating Packaged ASP.NET Setup Programs with VS 2005” ; “Recipe: Using VS 2005 Web Deployment Projects”; “Tip/Trick: Spell Checker Plug-in for VS 2005 for ASP.NET and HTML Pages”; “Recipe: Paging through lots of data efficiently (and in an Ajax way) with ASP.NET 2.0”; “Recipe: Efficient Data Paging with the ASP.NET 2.0 DataList Control and ObjectDataSource”; “Recipe: Enabling Windows Authentication within an Intranet ASP.NET Web application”; “Tip/Trick: Disk Based Output Caching Feature Now Available for ASP.NET 2.0”; “VS 2008 Multi-Targeting Support

Random Screenshot: A “Blank” SharePoint Site in a GNOME Folder

Random Screenshot: A “Blank” SharePoint Site in a GNOME Folder

So let’s take a peek at what Windows SharePoint Services (WSS) generates for a “Blank” Collaboration Site. What jumps out at my inexperience with the inelegant innards of SharePoint is the absence of .ASPX files. There’s locale resources, some FrontPage-looking (WebDAV) stuff, some kind of browser capability database (see “Add Blackberry support to Forms Server 2007 or SharePoint 2007”), a *.DLL file for SOAP, a *.DLL file for ‘application pages,’ two different web.config files and the global.asax file that is probably doing most of the heavy lifting.

I assume the rest of the site is in the Content Database. And, oh, by the way, I had some kind of disk catastrophe yesterday and lost a 300meg WSS Content Database! Because the log had some open transactions I could not recover the database. I got almost everything back as disk files (not in SharePoint) from a backup.

More Mono stuff off the TODO list…

In the second month of 2008 came “Mono Uninstalled (for the moment)” and I tried again egged on by these links:

The bottom line is this: I am unable to locate any documentation about the lower limit of GTK support for MonoDevelop. And I write ‘GTK’ with the very real possibility that I am blurring GTK into GTK#. My strong suspicion is that my current version of Ubuntu (6.0.6) has a hard Gnome GTK limit (without serious mods) (which is why I cannot run Firefox 3.x)—and that the current 1.0 version (and future versions) of MonoDevelop will simply not run on it.

This implies upgrading Ubuntu. Sounds “easy” but it should be known that, according to VMware “Supported Guest Operating Systems,” the latest version of Ubuntu is not supported by VMware Workstation 6.x—and I’m using Workstation 5.x!