One has to say that coding is fun... because it really is ! Well, usually ... !

The THAT day comes and you feel like someone really crashed into your car ! And THAT day is today for me. My Diavolo CMS was almost ready to debut when I crashed into a very nasty problem which will probably force me to work on that the whole Summer to basically change... everything ! So hello blogs for coding : this is my first BIG rant ! Sealed Ok, this will be my 2nd rant since my first one is: has this editor a way to ABSalign pictures? Whoa! Can't believe I have to manually edit HTML to get that...

So I had this new CMS and I've been working on that since many months. Basically, I wanted to use Microsoft Webparts framework and have all those nice features packed and ready, while I was going to extend a lot of them. It's not Sharepoint but it's an awesome piece of software. I won't go into details like support for objects database and stuff, but I have to say I had all the theming stuff ready, wrote a lot of classes and extensions to basically reproduce everything from big CMSes and of course it was .NET 4 only ! The I came down to new routing functionalities for .NET (those are awesome!) and had this strange error, you know that one which reads like:

Server Error in '/' Application.


The file '/pageid/1/default.aspx' does not exist.

 

Undecided Hmm... what ? Anyway, when you've been down to subclass WebpartManager, WebpartZone, Webpart themselves, WebpartChrome, WebpartEditorZone, lots of providers including personalization, membership, VirtualPathProvider, lots of other stuff from other parts of the framework, well, then you've been down to cope with a lots of problems so I wasn't very scaried about that.

I have to admit I really underestimated that problem as I was sure I could find a way to fix that and go on, like in past 4-5-6 months. But I really feel this time I was wrong!

The problem is, when you toggle scope for webpartmanager class, and switch to shared from user, ToggleScope() method internally uses Server.Transfer to return control to page where that has been generated. Guess what? Using Server.Transfer is a big NO-NO when using .NET routing as that method won't pass through standard IIS pipeline and thus routed paths (i.e. virtual, non-existent paths generated by your routing mappings) will generate that error. That is, file does not exist. I started to get scaried when I read a blog post about this problem where author was stating that this is a bug Microsoft acknowledged but that would hardly be fixed anytime soon, and that was Sept. 2009 !

So it's great ! I have this big load of code working and almost ready, anything, zones, modules, editors, chromes, providers, jQuery, MS AJAX, themes and everything... but now I have to decide what to drop ! If I drop routing, I could revert to standard, ugly, QueryString-enabled pages (bad bad bad!) and say goodbye to fancy AND useful SEO-friendly URLs, unless I want to use URL rewriting module, maybe; or I need to drop the WHOLE webpart framework, keep SEO URLs and start over to write replacement for webparts in my portal code. Darn!

How can Microsoft fail to emphasize that two very important parts of their framework aren't compatible ? True, webparts are probably one of less used (but most powerful) features in ASP.NET but ... !

Yeah, I was really stupid not to extensively try routing and webparts together before going down to write tons of code but I didn't expect them not work AT ALL ! I expected that to be hard and difficult, the way it usually is, but didn't suspect Microsoft could leave such hole opened. My fault, I guess, but MS doesn't work like that, usually and that's why I didn't expect.

Great! My first rant on this blog... !