Hannes writes, "I'm currently working on maintaining rewriting an application from the early days of ASP.NET (c. 2001) to be all AJAXy and Web 2.0. One of the first things I stumbled over when I first fired up the debugger was a strange exception - the RedirectException - that got thrown on almost every page. Sometimes, it was thrown more than once in the page lifecycle, but it never made it up to the front-end.

"I quickly found out the developer didn't quite get the concept of exceptions.

try 
{
    if (!isCustomer) 
    {
        -- snip lots of code to process a new order --
        throw new RedirectException("/Orders/NewOrderShipping.aspx")
    }
    else if (isQuickOrder)
    {
        -- snip more order processing code --
	throw new RedirectException("/Orders/Confirm.aspx")
    }
    else
    {
        -- snip even more order processing code --
        throw new RedirectException("/Orders/SelectShipping.aspx")
    }
}
catch (RedirectException rEx)
{
    Response.Redirect(rEx.Message);
}
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!