When I started blogging, Dan Hounshell did a blog post about it (Digging My Blog - Dan Hounshell Joe Wirtley is blogging!) and said he was looking forward to hearing about my anecdotes and experiences, including things that I "hate about .NET". And I've done very little to live up to that expectation, until today.
I've seen a flurry of blog posts and other references lately about using the App_offline.htm to make a site unavailable in ASP.NET 2.0. The summary of this feature is that you can just drop an HTML file named app_offline.htm into the root folder of your web site, and it will take the site offline and display the contents of the file. If you happen to be looking for information on this feature, I would recommend Scott Gu's blog: ScottGu's Blog App_Offline.htm and working around the IE Friendly Errors feature. The important thing to note about this feature is that you must be sure that the file is long enough, or it will generate errors in IE.
Now, I don't hate this feature. It's a nice feature. What I hate is that it is undocumented. And that it works using a "magic name". There's no configuration. No property to set. No choice as to what the file is called. You just have to know the magic file name to make it work. That, I hate. And it feels like the kind of things Microsoft has done over the years that, prior to .NET, made me avoid doing development with Microsoft development tools.
In particular, it reminds me of one situation I encountered doing classic ASP development. I created fairly standard ASP/COM web sites, with the exception that I developed COM objects in Delphi rather than VB (I was never a VB fan). For the most part, that worked well. One challenging part was getting enumerators on collections to work. It was easy to find the interface to implement in Delphi. And to implement it in Delphi. The hard part was finding out how to get the enumerator from ASP, since there was no defined/documented interface for that. After some searching, I finally figured out that there's a "magic number" for the dispatch ID, which I believe is -4 (but don't take that as certain if you happen to be doing ASP development with Delphi COM objects...) So, as it turned out, all I needed to do was return the enumerator interface when the COM object was asked for dispatch id -4. Perfectly intuitive.
Just like the app_offline.htm magic name. I can just imagine the developer who happened to use name app_offline.htm as his "standard" offline file name. He just puts the file there and the site starts using it. Then he starts looking for code that calls it. And he can't find any. That would certainly look like magic.
And now that you know about app_offline, it could be an interesting way to play a prank on your fellow developers who do not read blog posts... I can imagine an app_offline.htm that looks like a .NET error page; that could take a developer out of commission for a while. (The author of this blog is not responsible for any consequences resulting from the improper use of this information.)
0 comments: (+add yours?)
Post a Comment