MVP Chalermvong and his session - ASP.NET Performance Up!

Learning how to work with ASP.NET Web Forms is the other thing of “New Things Learned in the Labor Camp”… I’ve avoided confronting ASP.NET “classic” directly for years. Instead, I made the right decision to learn things about Web programming and Web design that Microsoft notoriously undervalued in its professional communication for years until the rise of Scott Guthrie from ASP.NET “classic” to ASP.NET MVC.

Sadly, there is a job market full of IT shops that are deeply invested (often emotionally invested) in ASP.NET “1.9”—the way of seeing the Web through the Microsoft looking glass just before ASP.NET 2.0 was released in 2005.

For years I’ve “run away” from confronting ASP.NET Web Forms directly. The following interview questions I’ve slapped together “finally” engage—directly. By the way to show that I’m super serious about this matter, I’ve literally spent hours over about two weeks building samples for ASP.NET for Web Forms in my studio.

What are ASP.NET Web Forms?

ASP.NET Web Forms is a technology that breaks down a plain-old HTTP Request into a series of clearly defined events (classified broadly under initialization, load and render)—these events describe the “life cycle” of a familiar model, the data-entry form in a Web page. ASP.NET is based on the event-driven programming paradigm made popular and traditional by Microsoft in the 1990s.

What is a ‘Post Back’?

The ‘Post Back’ is the concept developed by Microsoft that stands between the post HTTP verb and the first event recognized by an ASP.NET Page. Typically, the Page.IsPostBack Boolean is checked in the Page.OnLoad event handler. When Page.IsPostBack == false then the get HTTP verb is the request. Microsoft has defined a conventional Jscript function, __doPostBack(), that invokes the ‘Post Back.’ ASP.NET Web Forms seem crude and extravagant in the 21st century when a page-level post action is regarded as expensive and disruptive (ASP.NET AJAX was supposed to remedy this).

Why do ASP.NET controls require a parent form?

Without a parent form element, the ‘Post Back’ concept is not implemented. Conventional hidden fields in the form store event metadata (__EVENTTARGET, __EVENTARGUMENT, __VIEWSTATE).

See also:TRULY Understanding ViewState

What is the AutoPostBack property?

The AutoPostBack property is a Boolean that is apparently defined independently and conventionally in the System.Web.UI.WebControls.ListControl, System.Web.UI.WebControls.CheckBox and System.Web.UI.WebControls.TextBox. When AutoPostBack == true an event associated with these controls (select, check, blur) will cause a Post Back.

See also:
System.Web.UI.PostBackOptions and System.Web.UI.Page.AutoPostBackControl.

super smart msft peeps

What is a Cross-Page Post Back?

By default, an ASP.NET page “posts back” to itself (frequently). A Cross-Page Post Back declares that one Web Form should post to another Web Form—not back to itself. Input captured in the posting page can be captured in the receiving page via the Page.PreviousPage property.

Tip: The Page.IsCrossPagePostBack property is always null. During a cross page Post Back Page.PreviousPage.IsCrossPagePostBack will be true.

See also:

What is a Server Transfer?

An ASP.NET Server Transfer allows a Page executing on the Server to Transfer execution to another Page. It can be thought of as a call to another procedure from the currently executing procedure. In terms of a POCO class, a Server Transfer is a method call in a procedure of one class with a member from another class—the catch is that no arguments can be passed in the method call. After a Server Transfer, the new page running has access to all of the Request, Session and Application-scope data in the old page. Importantly, there is a Page.PreviousPage property which can be used with FindControl() to locate controls on the old page.

According to Microsoft MVP Karl Moore, “So, in brief: Response.Redirect simply tells the browser to visit another page. Server.Transfer helps reduce server requests, keeps the URL the same and, with a little bug-bashing, allows you to transfer the query string and form variables. …Don’t confuse Server.Transfer with Server.Execute, which executes the page and returns the results. It was useful in the past, but, with ASP.NET, it’s been replaced with fresher methods of development. Ignore it.”

See also:ASP.NET Server.Transfer Method

What is a Master Page?

The ASP.NET Master helps keep Web Forms DRY. They share visual elements among several ASP.NET pages providing the “consistent look and feel” Web designers expect. ASP.NET Master pages also centralize HTML page “meta” information, much of the angle-bracketed ceremony that make Web page markup noisy.

How does a Master Page affect the Control.FindControl function?

The ASP.NET Master adds one or more ContentPlaceHolder controls to the visual tree. These in turn demand Content controls, which implement INamingContainer—a “naming container” affects the ID attributes of child controls “inside” the container. So: a control named foo inside a naming container, bar, can be located by Control.FindControl("bar$foo") where Control would be an instance of the Master page in our example.

The ASP.NET Dream Team

How do Web Forms handle Validation?

ASP.NET handles Validation with PostBack-dependent server controls. These server controls share a ControlToValidate property, pointing to the input-related server control to Validate. There are validation controls for marking input as required, checking input for a data type, testing input with a Regular Expression and testing input with custom code.

One little annoyance: custom validators don’t work with blank input—so they must be paired with the validation control for marking input as required (RequiredFieldValidator).

What are Validation groups?

Validation groups allow more than one “validation context” to exist in a Web Form. For example, a layout with a GridView might have an EditItemTemplate with one Validation Group for editing while another form used for inserting new rows into the grid will have another Validation Group. Validation groups are declared with the ValidationGroup property.

What is a “Partial Page Update”?

The “Partial Page Update” is made possible with the UpdatePanel and the ScriptManager, which is the heart of ASP.NET AJAX. This extension to ASP.NET introduced in version 2.0 dramatically reduces the need to do the “classic” PostBack by implementing the “asynchronous PostBack” a.k.a. the “Partial Page Update.”

@MossyBlog [Scott Barnes]: “@maryjofoley article on the XAML Fallout –zdnet.com/blog/microsoft…

@timheuer [Tim Heuer]: “Telerik goes Metro…now for both Silverlight and WPF:http://goo.gl/ArBY8 – very nice.”

@nicewebtype: “Interesting differences between CSS reset and normalization.http://t.co/E935AGL @h5bp now uses normalization. Hmm…”

@elijahmanor [Elijah Manor]: “Code Review: jQuery Waypoints by @dailyjs #jqueryhttp://bit.ly/iuB86d

@elijahmanor: “‘Exploring CoffeeScript Part 1 – And Then There Was Coffee’ by @elegantcode #javascripthttp://bit.ly/jlUzTn

@smashingmag [Smashing Magazine]: “Grid Navigation Effects with jQuery – http://bit.ly/irce3O

@elijahmanor: “Save yourself some typing when you call ASP.NET services” by @Encosia #jqueryhttp://bit.ly/ku0hl2

@mozlabs [Mozilla Labs]: “Firefox 5 released – what’s new for web developers:http://mzl.la/jFo989 /via @mozhacks

@elijahmanor: “HTML5ify your ASP.NET MVC 3 applications” by @RachelAppel #aspnetmvc http://bit.ly/m8RwlZ

@MSExpression: #SketchFlow template for WP7 [Developers] –http://bit.ly/mBlAHs#WP7dev #msexp

@scottgu [Scott Guthrie]: “For those that missed it earlier this week – check out @shanselmanpost on VS 2010 HTML5 Web Extesnion: http://t.co/yCytShx

@vpieters [Veerle Pieters]: “Novecento is an uppercase-only font family, free otf and web format” http://t.co/4dqjAG8 /via @benev

@SilverlightNews: “Mango : What’s new in Windows Phone 7.1” – http://t.co/7zLEX8T

@SilverlightNews: “I Want To Make Cars Not Car Engines” – http://t.co/kJQ5E3t

@thelazzyone [Aaron]: “The original DOOM ported to your browser with HTML5 & JavaScript” – TNW Design & Dev http://t.co/5dS05ma

@thinkvitamin: “WebP: 38.9% faster than JPEG” http://bit.ly/jSbwLl

@Silverlight: Free @silverlightshow webinar: “Secure and Personalize your Silverlight App with WCF RIA Services” May 25, 10am PST http://bit.ly/mqqH74 … “This webinar was delivered on May 25th. Watch recording!

@Wessty [David Wesst]: “Day 1 session online courtesy of @ch9! My fav for the day: An Overview of the Microsoft Web Stack” by @shanselman http://d.wes.st/jHh8Rz

@elijahmanor: “Build ASP.NET MVC 3 applications quickly with MvcScaffolding” by @RachelAppel#aspnetmvc http://bit.ly/loTlHM

@bsubra [Bala Subra]: #Lab49: “Sparklines in WPF and Silverlight: One seemingly-trivial-yet-recurring problem in financial software i…” http://bit.ly/lLd6Bj

@elijahmanor: “An In-depth look at jQuery.map() in 1.6” #jquery http://bit.ly/kYsJCL

@maryjofoley [Mary Jo Foley]: “Microsoft and Nokia finalize their Windows Phone collaboration agreement: http://zd.net/eF9gRg

@smashingmag: “The CSS3 Flexible Box Layout (flexbox)” – http://bit.ly/f4X1Xa

@kegill [Kathy E Gill]: “Design Inspiration: 25 Websties built with HTML5 & CSS3” http://t.co/dTMzPmN via @ziteapp

@smashingmag: “Susy: unobtrusive grids for designers with Compass or Sass” – http://bit.ly/gzHycN #useful

@DennisCode [Den Delimarsky]: “Screencast: How to Debug a WP7 App Without the Debugger Attached” http://t.dennisdel.com/g787Rj #wp7 #wp7dev

@aarron [Aarron Walter]: “A typeface designed to visualize data using ligatures. Head sploded.” http://bit.ly/g7B4te

@vladimir_enchev [Vladimir Enchev]: “RT @mvalkov: The new version of #telerik #silverlight/#wpf #RichTextBox with comments, RTF, bookmarks and more! http://bit.ly/9CGRia

@leebrimelow [Lee Brimelow]: Convert FLA to HTML5 right now using “Wallaby” – http://adobe.ly/fREbe6 #flash #html5

@engadget: “Bloomberg: Microsoft to pay Nokia ‘more than $1 billion’ to make Windows Phones” http://engt.co/gSbLyf

@jbristowe [John Bristowe]: “ie9ify – a jQuery plugin for adding IE9 features (site pinning, site mode, etc.) to your websites: http://bit.ly/hbhIez

@Telerik: “The Brilliance of Microsoft + Nokia” http://tlrk.it/fRL7iI #wp7 #wp7dev#windowsphone7

@davewiner [Dave Winer]: “A few simple requests for developers who make Twitter clients.” http://r2.ly/6va5

Brandon Satrom (via Scott Guthrie tweet): “Of course, a number of tools have been created to help you implement BDD in your development process. These include Cucumber in Ruby and SpecFlow and WatiN for the Microsoft .NET Framework. SpecFlow helps you write and execute specifications within Visual Studio, while WatiN enables you to drive the browser for automated end-to-end system testing.”

Post Sharp (Ayende Rahien)

PostSharp is an AOP framework that works using byte code weaving. That is, it re-writes your IL to add behaviors to it. From my point of view, it is like having the cake (interception, byte code weaving) and eating it (I haven’t even looked at the PostSharp source code, just used the binary release).”

“Azure Storage Explorer”

David Pallmann: “I’ve been wanting an easier way to view what’s in my Azure cloud storage so I decided to write a tool for the purpose. Azure Storage Explorer now exists and is available here on CodePlex.” I prefer this tool over CloudXplorer as it shows Table Storage.

“Cloud Innovators: Netflix Strategy Reflects Google Philosophy”

cloudscaling.com (via John Lam tweet): “Adrian and other Cloud Innovators have proven that designing for cloud scale, means designing for failure and the same ‘always-on’ software architecture of an Amazon.com or Google, *not* something as simplistic as virtualizing your existing legacy enterprise applications and moving them over to someone else’s cloud. It’s going to take a while for the market to wake up to this principle and we’ll see lots of failures or as I like to say “blood on the floor” over the next few years.”

Wikipedia.org Moment: Heroku

Heroku is an online Rack (and by extension, Ruby on Rails) cloud PaaS (Platform as a Service) run by the San Francisco, California based company with the same name. As one of the very first cloud platform as a service providers, Heroku has been in development since June 2007 and the company reports over 119,000 applications running on its service.”

Jeremiah Morrill: “If you’ve been following my Twitter stream the last few months, you might have noticed I’ve been taking what looks like some pretty cheap shots at WPF (and Silverlight for that matter) performance. Why would I do that? After all I have invested hundreds, and hundreds of hours of my own time over the years, evangelizing the platform, building libraries, community help, guidance etc. I am by definition, personally invested. I want to see the platforms get better.”

“Designspiration » WP7 App » Marketplace Browser”

Designspiration syndicates feeds from many inspirational design blogs including Design Mind, Core 77, Cool Hunting, Design Observer, FFFFound, Smashing Magazine, Vandelay and more. You can select or deselect the blogs as per your preference. Send us your feedback from the app if we are missing to cover any of your favorites and we’ll add them as an update.”

“Exclusive: Nokia’s Windows Phone 7 concept revealed!”

Vlad Savov: “Look what we’ve found! This is the first image you’ll see anywhere of the early fruit of Microsoft and Nokia’s budding new partnership. We have it on good authority that the technicolor phones on show are conceptual devices produced by the two companies. You shouldn’t, therefore, go jumping to conclusions about retail hardware just yet, but hearts should be warmed by the familiarity of Nokia’s new design—the shape of these handsets is somewhere between its recent N8 and C7 Symbian devices and there is, as usual for Nokia, a choice of sprightly colors. The trio of keys adorning the new concept’s bottom give away its Windows Phone 7 ties, but also remind us that the N8 and E7 are highly unlikely to receive any WP7 upgrade love. The best part about this whole discovery, however, might be that it confirms Steve Ballmer’s assertion that the engineers of both companies have ‘spent a lot of time on this already.’”

“Microsoft $2.25 Billion Debt May Reward Shareholders”

Sapna Maheshwari and John Detrixhe: “Credit quality will weaken among investment-grade issuers this year as companies facing ‘limited’ business opportunities, take advantage of relatively low interest rates to repurchase stock, according to Janney Montgomery Scott LLC. Bonds issued by Microsoft in its last U.S. offering in September have tumbled, while the company’s shares have climbed 14.4 percent.”

“WPF: adding thumbnail buttons to Windows 7 Task Bar”

Brian Lagunas tweeted by Scott Guthrie: “Thumbnail buttons are buttons that can be added over your application’s icon that allow the user to execute custom actions.  If you are using the Windows Scenic theme, the buttons will show just below the applications screenshot when you hover over the application icon in the task bar.”

“WP7: Den Text-Cursor bei der Eingabe von Text exakt positionieren”

Eingestellt von Martin: “Der Finger wird leicht auf den Bildschirm gedrückt und gehalten. Nach einer halben Sekunde erscheint mit einer kleinen Animation ein virtuelles Cursor-Symbol. Weiter den Finger auf dem Bildschirm halten und über den Text (den Bildschirm) bewegen. Das virtuelle Cursor-Symbol folgt der Bewegung des Fingers und bewegt sich durch den Text. Dann einfach den Finger vom Bildschirm nehmen, sobald das Cursor-Symbol an der gewünschten Position ist.”

The highest demand skill in the IT consulting business is never asked for explicitly by clients and has nothing to with technology. The highest demand skill in the IT consulting business is the ability to undo the mess your client got himself into—and I deliberately use him because this is really a guy thing. We have all heard tales about guys that refuse to ask directions when driving completely lost. Now imagine trying to be a “team player” with a guy that is in your opinion lost—and you know that your opinion has little effect on the situation even though you have been hired as a “consultant.” This has been the running theme for most of my career—only in recent years has my work with clients made a turn for the better.

An excellent mental health exercise for an IT consultant is to examine the word professional—instead of just blurting it out. Inside this word is profess—what this means to me is that a professional has the ability to “claim openly” or publically. The ideal engine driving one to make such “open” claims is fueled by accurate, researched information. In the IT business, accurate information comes from the tool makers like Microsoft, Oracle (Sun), or the auspices of an Open Source project—maybe a University. When your client fails to recognize the existence of this third-party research while at the same time using said third party’s tools then in my opinion you are up shit creek—a creek probably polluted by the company that hired you…

Here are some things that can happen while you are up shit creek:

  • The definition of “professional” changes into the ability to put lipstick on a pig in an elegant, quiet, polite manner. Pay that mortgage and shut the f’ up.
  • Your client is effectively in conflict with their tool makers. This means you are fighting on about three fronts: battling the actual business “challenge”; battling the tool maker; and battling legacy issues associated with the new “challenge.”
  • Your client may wonder why you are unable to perform “professionally” under these circumstances instead of actually looking at the real problem. It’s a childish, fascist impulse that is almost impossible to resist.

FOWA 08 - Password Anti Pattern

In the same manner Warren Buffet would refuse to invest in company he does not “understand,” you have the human right to invest your energy in other companies, organizations and other parties that appear to actually have a professional technology plan. In the same manner that business planners are expected to summarize their strategy with a single coherent sentence, your clients should have provided you with enough information to profess their technology plan with a single coherent sentence. Sometimes we may confess instead of profess (listen to “this developers life 1.1.1: scars”)…

From my experience, the leading reason why clients get themselves into a mess (they have tacitly asked you to get them out of) is because they have ignored/defied their tool maker. Your client and you are swimming a soup that the tool maker never told you to cook. It has taken me way, way too long along the timeline of my career to actually get proactive and begin to look for patterns (actually anti-patterns perhaps) of such ignorance and defiance. I confess that I tend to concentrate on researching my tool maker (Microsoft) instead of researching “bad” (but cash rich) clients. I am unable to even recall a book about this subject—especially in the Microsoft world. I have no pipeline in place to collect such information. My attitude has been one of aggressive divestment a la Warren Buffet—which should strongly suggest that I have no mortgage to pay. Oh, when will I grow up?

Here are some Microsoft-centric 30,000-foot anti-patterns I can barely recall:

  • Using Microsoft Access (*.MDB) as a LAN-based DBMS for dozens of users, when it was designed for one user on one desktop (c. 1996).
  • Using Microsoft Access as a database for a web site (early 2000s).
  • Running ASP sites with global DLLs that get locked by the Web server process (early 2000s).
  • Using Microsoft Office effectively as a frontend (without SharePoint) while using Java-based server technology as a backend (UCLA MCCS, early 2000s to present).
  • Using Microsoft FrontPage for anything (all eternity).
  • Using Windows Forms 1.0 for anything (all eternity).
  • Using ASP.NET Web Forms and Server Controls with a view to being standards-compliant and cross-browser compatible (early 2000s to 2010, yes 2010).
  • Using JavaScript according to the Microsoft-tooled vision of Jscript (early 2000s to 2009, with jQuery).
  • Using more than a handful of ASMX Web Services per ASP.NET project (for all time: use WCF).
  • Attempting to customize SharePoint (for the lifetime of the product to the present …perhaps).

One of the mature things I have accomplished recently is consciously accepting that my tool vendor, Microsoft, was not exactly fostering a culture of tool-maker compliance for many years. Microsoft has profited to the tune of billions with the rollicking banjo music of wild-west mentality… The earliest technology evangelists from Microsoft that I can recall are: Alison Balter (1994), Paul D. Sherriff (1991), and Don Box (turn of the century)—none of these folks left me with professional theories that I can recall (apart from Relational Theory and this little thing called “OOP”). Now we have the Scott Guthrie generation at Microsoft, trying to introduce a cornucopia of publically-accessible theories to customers with acronyms like MVC and MVVM in the face of massive legacy—Wild-West, COM-based legacy written in HTML (using all caps for tag names) and this weird thing called “HTC”…

Microsoft has two massive product spaces: Dynamics CRM and SharePoint. As of this writing, deep into the 21st century, none of these products reflect the new Scott-Guthrie-style professionalism that should make serious investors happy. Microsoft itself has a Wild-West legacy load that it is digging itself out of… because old cash cows can’t be abandoned for greener pastures…

Related Links