I've successfully created a routing class which re-routes urls when someone types in:
http://myurl/myfolder/{someletter}. This allows people to get some data from a database which starts with {someletter}, e.g. "a".
The folder called "myfolder" above contains a file in it's root called "default.aspx", e.g.
http://myurl/myfolder/default.aspx which is just a signpost page and contains alphabet links to direct people to the url above. This all works fine.
However, I encounter a problem when I add another entry to the routing table which adds an extra level, e.g:
http://myurl/myfolder/{someletter}/{somearticle} (So people can get a specifIc article under that letter).
For some reason whenever i browse to
http://myurl/myfolder/ it tries to route to:
http://myurl/myfolder/{someletter}/{somearticle} for some bizarre reason? Does anybody know why this is?
I've stepped over the code in my class which handles the RequestContext and implements
IRouteHandler and I can see it trying to route when I just browse to "myfolder".
Here's my code:
privatevoid RegisterRoutes(RouteCollection Routes)
{
System.Web.Routing.Route r1 = new System.Web.Routing.Route("myfolder/{someletter}", new UrlRouting.MySimpleRouteHandler());
System.Web.Routing.Route r2 = new System.Web.Routing.Route("myfolder/{someletter}/{somearticle}", new UrlRouting.MySimpleRouteHandler());
Routes.Add(r1);
Routes.Add(r2);
}
protectedvoid Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
I cannot work out why this is occurring. Any help would be much appreciated....
Regards