/// Sunday, December 4

ASP.NET aaargh!

I'm deciding how to expose server-side methods to AJAX clients of non-Gamba developers. I want Behaviour.NET to be usable outside of Gamba. AJAX is easy for Gamba or any MVC2 framework for that matter. A controller can expose any combination of views or methods. In Gamba's case, a server-method's logic is as simple as changing the response content type to Content.TextPlain, Content.TextXml or the default Context.TextHtml then return data directly bypassing the usual logic of rendering views.

In ASP.NET you don't get a controller, you get a stupid page. I have some options. I can derive from the ASP.NET Page to create a BehaviourPage. Developers then change their code behind to inherit from BehaviourPage. This lets me create a page controller for pages taking advantage of Behaviour.NET. Remote call would need be encoded in the query string of that page. But, what if a shop already has custom page in place? This folks is one of the many reasons why the ASP.NET page framework sucks!

The other option is to commandeer the .ashx extension and create an MVC framework strictly for AJAX methods like web services does with .asmx. I could use a different extension but .ashx is supported natively by ASP.NET. Using a different extension would prohibit its use in a hosted environment where you can't change IIS mappings. Even worse, .ashx may already be in use.

Yet another option is to hook into the lifecycle events. Seems too manual for me, but it maybe the only option I have.

If anyone has any other suggestion please speak up. It's why I think aloud on my blog. It's a think-tank.

I've told some people interested in this library it would take about a week to create a standalone version of Behaviour.NET. I forgot about the pains of ASP.NET. I'll get it out guys. I want to make it simple for you, so don't shoot me if it's not out in a week.


Implement an HTTP module (the new fangled ISAPI filters)?
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?