在路由规则里,写了这样几条规则:
//分类路由
routes.MapRoute("category",
"list/{filterAttr}-{cateId}-{brandId}-{filterPrice}-{onlyStock}-{sortColumn}-{sortDirection}-{page}.html",
new { controller = "catalog", action = "category" },
new[] { "TipFlexMallNew.Web.Controllers" });
//分类路由
routes.MapRoute("shortcategory",
"list/{cateId}.html",
new { controller = "catalog", action = "category" },
new[] { "TipFlexMallNew.Web.Controllers" });
//店铺路由
routes.MapRoute("store",
"store/{storeId}.html",
new { controller = "store", action = "index" },
new[] { "TipFlexMallNew.Web.Controllers" });
//店铺商品路由
routes.MapRoute(
"storeProducts",
"store/{desc}-{storeId}-{SortBy}-{CurrentPage}.html",
new { controller = "store", action = "index" },
new[] { "TipFlexMallNew.Web.Controllers"}
);
现在的问题是:前面两条路由规则显示都没有问题,后面两条就有问题了。分类路由显示正常,比如:分类的ID是170,显示在URL上的是:IP/list/124.html
对分类进行筛选,选中之后的,URL是这样的:IP/list/0-0-124-0-0-0-4-1-1.html
但是店铺的就有问题,进入店铺的URL是:IP/store/5.html
但是筛选的话,就出问题了。变成这样:IP/store/5.html?desc=0&SortBy=0&CurrentPage=1
店铺的筛选是这样写的:
<a class="@SortFirst" href="@Url.Action("index",
new RouteValueDictionary { { "desc", DescInt }, { "storeId", WorkContext.StoreInfo.StoreId }, { "SortBy", 0 }, { "CurrentPage", 1 } })">
综合排序
为什么会这样,不科学啊,我已经重新生成了好多次了。。