Rethink the ASP.NET page model/life cycle

June 15th, 2007

Karl Seguin (hey, that sounds like Carl Sagan!) posts about his .net wishlist:

Thinking beyond the common request to implement an MVC pattern, I’d be great if the ASP.NET team could rethink the current model and life cycle. It leaks badly in any complicated scenario. 6 years after its release, I still don’t fully understand it, and I’m ready to bet that I’m in the overwhelming majority. The only time it doesn’t leak is when you don’t need any of the fancy stuff it tries to do. I’m almost at the point where I just don’t use .NET if I’m building a heavy web-based application. Forget learning an O/R mapper, test driven development or understanding domain driven development, the single best thing any ASP.NET developer can learn right now is MonoRail.

I would say that Test Driven development is something that you should learn, though, but aside from that who can disagree? I do understand the page lifecycle, and I understand why they did come up with it. I just think that it has its consequences, and that is unavoidable. You can have the cake and eat it too?

And that’s something I’ve been thinking for sometime. Since Georges Benatti joined Stronghold he has been complaining (nicely) that there should be a way to build reusable pieces. We do have ViewComponents, but it’s not enough. I’m not looking for a breakthrough, but I’m looking for something between Helpers and ViewComponents.

Just so you can understand where I came from. Here at the Stronghold we are always doing complex UI. Not because we think UI must be complex, but because we care about providing a better experience. But we do have to write complex ajax application, mostly on the client side, and we write similar things. We can vary on the logic, on the effects, but overall it’s similar.

There must be a better way.

And to make it even clearer, I like javascript a lot. I think it’s great powerful dynamic language. Sometimes I look at a C# statement and wonder “gosh, I wish I could use a js like closure here”.

The other extreme is WebForms UI components infrastructure. There you are locked in a specific way to create apps. I think MonoRail 2.0 should present an alternative. Non intrusively it should allow you to have full control — like it does now — and in addition allow you to lent some of the control in exchange for more productivity.

I have a dream! :-)

16 Responses to “Rethink the ASP.NET page model/life cycle”

Jeff Brown Says:

There’s not a whole lot between Helpers and ViewComponents… I expect you actually want something that also provides a wee bit of controller-like logic. Like a sub-controller. This would be a reusable chunk that could be embedded within a delegating controller to service part or all of a request related to components owned by the sub-controller.

Dunno if MonoRail has anything like this already.

hammett Says:

Can you expand on how you this shoud work and what problems it resolve? I’m leaning to a solution to prevent JS duplication, or some smarter way to generate JS code…

Colin Ramsay Says:

I have trouble with anything that auto-generates javascript. It just doesn’t feel right.

Complex UI with Monorail, Javascript & Caching « Ya know, stuff Says:

[...] Complex UI with Monorail, Javascript & Caching Coming to the end of the development cycle of a fairly large & Javascript dependant project, a few issues have cropped up that will probably need resolving before going full production. Im glad that hammett seems to be having similar problems, & it’s not something that has already been solved that I have ignored within MonoRail. [...]

Steve Gentile Says:

At one point in time you mentioned you use the Yahoo UI API?

I do like that way they setup ‘PageMethods’ in for ajax:

I’d like to do something similiar with that ease of programming as in that sample – w/Monorail.

hammett Says:
Steve Gentile Says:


I didn’t know it did – this is fantastic :)


Steve Gentile Says:

After attempting to duplicate that example (if that is what you call it), I get no results of any sort when I click on the button.

I find the documentation to be poor. There isn’t any decent examples, they are just snippets of code here and there, no substance.

Any real samples out there that a beginning can look over?

hammett Says:

Yeah, yeah, yeah. Steve. You always say that. We’re not a documentation project, not even a sample code factory. Documentation, unfortunately, is always neglected by OSS project without a big, wealthy company behind it. Sorry about that. If you can jump in and help us, fantastic; if not, there’s nothing much I can say aside from showing my will to get it better. But I have different priorities at the moment.

Steve Gentile Says:

My post wasn’t to frustrate you, excuse me if so. I understand your situation.

I just want to use this but I don’t have a clue as to how to do it.


input type=”button” onclick=”javascript:myproxy.DisableUser($(‘userid’));”

I set a breakpoint in my controller. Button is clicked, I see it hit that controller ‘DisableUser’ function.

I call ‘RenderText(“Done”)

Nothing displays.

Any ideas?

Perhaps a company like JBoss can do for you what they did for NHibernate – would that be what you need ?

hammett Says:

There’s a company: Castle Stronghold. Unfortunately it has a long way to become a wealthy one. But we will get there.

About your question. The OK will be the return of your function. So


may show you the way

Steve Gentile Says:

The alert shows the message ‘Done’.

Ok, so now I ask: how do you include javascript within Monorail?

For example, I want to handle the “OnSucceeded” event similiar to that sample above

function OnSucceeded() {
// Dispaly "thank you."
$get("ContactFieldset").innerHTML = "Thank you!";

Can I just add script tags to the vm with this function in it ?

Steve Gentile Says:

(I’ll go post in forum about this)

Zen and the art of Castle maintenance » Blog Archive » The usual FUD about MonoRail Says:

[...] That being said, I do think that jdn has a point. And that’s why I think MonoRail should offer an alternative. Sometimes I want to craft my UI, sometimes I want to just be fast and get something working real quick. I wrote about some of these ideas earlier. [...]

Che Goluska Says:

I’d love to see someone do something for monorail like the google client framework, which allows you to make your source in java and compile your client side javascript after it passes all your tests.

thinking in geek » Blog Archive » SoC in WebForms Says:

[...] Genius – this summarises an entire field of criticism (e.g. [1][2]). The whole issue with the OnRowDataBound/FindControl() style of programming is that things which [...]

Leave a Reply