The code below catches almost everything.
http://www.mysite.com/
for instance would still be routed to default.aspx,I think. But something like
http://www.mysite.com/some/page/that/doesnt/exist
would be caught by the TestRouteHandler. The {*fields} route specifier should wind up in the RequestContext.RouteData object passed to the router so you can do whatever you want. However, at that point, you're basically implementing a rewrite engine.
public class Routes
{
public static void Register(RouteCollection routes)
{
// setup legacy url routing
routes.Add(new Route("{*fields}",new TestRouteHandler()));
}
}
public class TestRouteHandler : IRouteHandler
{
public virtual IHttpHandler GetHttpHandler(RequestContext requestContext)
{
Page page = BuildManager.CreateInstanceFromVirtualPath("/default.aspx", typeof(Page)) as Page;
return page;
}
}
alternatively, you can specify a top-level route like
routes.Add(new Route("dave/{*fields}",new TestRouteHandler()));
which will catch items like.
http://www.mysite.com/dave
http://www.mysite.com/dave/test/parameter
http://www.mysite.com/dave/virtually/infinite/number/of/items/goes/here