Y'herd thisun? 

“In 1987 and 1988, a Commerce Department-led interagency working group considered the feasibility of offering a one-time prize and a promise of rent to any firm or consortium that could deliver a permanent manned moon base. When asked whether such a base were realistic, private-sector representatives answered yes -- but only if NASA wasn't involved. That plan was quickly scuttled.”

from Time to Privatize NASA by Edward L. Hudgins

Global.asax for embedded space urls

TaggedCoding, ASP.Net

Remaking this site to run on IIS... ELMAH quickly reminded me of that IIS issue:  ignoring custom error handling when spaces are in the url.

Mostly these come from those cute little korean/slav/russian php scripties, you know the ones, all the variations of: http://[domain]/page%20/index.php?errors=

IIS and web.config customErrors will take care of most odd url requests.. but embed a space and IIS will burp a smelly, and your web.config customError configuration section won't get called so the client will get a generic "resource not found" error page instead of your nice custom one.  You need to handle it in the olde Global.asax

void Application_Error(object sender, EventArgs e)
Exception exception = Server.GetLastError();
HttpException httpException = exception as HttpException;
if (httpException != null)

Yeah, yeah, it's all coming back now... so many years of leading to too much lazy trust in the high levels :).  So, now let me expose my supreme brain fart.  I added that classic to the global.asax and tested and tested in VS and nearly tore my hair out as every time I stepped to the Server.Transfer and got an "HTTPException was unhandled by user code"

Duh.  When you're F5 debugging a cassini instance in the IDE you'll break on errors.  The code is right, but only CTL-F5 (or releasing in non-debug mode) is going to run it correctly.

FYI: Even though you are handling the issue, ELMAH with thankfuly still grab and log/alert on the error AND the error statusCode will be passed back to the requestor (so they won't get a false positive code of 200... though in this case I think they should get a TRON logic bomb sent back across the wire).

These requests are of course most likely being done by bots, so the prettiness of the returned web page doesn't really matter, but there's always some tester in the crowd who will bug you on it, so there you go!

home     who is smith    contact smith     rss feed π
Since 1997 a place for my stuff, and it if helps you too then all the better