I have some routes defined in global.asax according to which the page is redirected.
Global.asax
void Application_Start(object sender, EventArgs e)
{
RegisterRoute(System.Web.Routing.RouteTable.Routes);
}
void RegisterRoute(RouteCollection routes)
{
routes.MapPageRoute("MainCategory", "{state}/{mcat}", "~/MainCategory.aspx");
routes.MapPageRoute("carriers", "{state}/{mcat}/{dcat}", "~/carriers.aspx");
routes.MapPageRoute("carrierdevices", "{state}/{mcat}/{dcat}/{carrier}", "~/carrieritems.aspx");
routes.MapPageRoute("cellphone", "{state}/{mcat}/{dcat}/{carrier}/{device}/{id}", "~/Catalog.aspx");
//New Rout with same parameters
routes.MapPageRoute("iphones", "{state}/{mcat}/{dcat}", "~/iphones.aspx");
}
i mean to say how to decide the destination page depending on URL
Eg:
1.routes.MapPageRoute("carriers", "{state}/{mcat}/{dcat}", "~/carriers.aspx");
2.routes.MapPageRoute("iphones", "{state}/{mcat}/{dcat}", "~/iphones.aspx");
if value in URL second parameter
i.e mcat=cellphone then it must redirect to carriers.aspx. and if mcat=iphone then it must redirect to iphones.aspx page
Problem:
currently if in URL there are 3 parameters then it always goes to carriers.aspx as it searches in route table for 3 parameters it redirects to carriers.aspx which need to be conditionally redirected depending on mcat value
how to do?
any idea?