0
以下のようにこんにちは、私はルートを登録している: - 私たちは、以下のようにこれらを生成ASP.NET MVC 3.0のURLルーティングの問題
routes.MapLocalizedRoute("Category",
"{SeName}-c{categoryId}",
new { controller = "Catalog", action = "Category", SeName = UrlParameter.Optional },
new { categoryId = @"\d+", SeName = @"([-\w+]+(/[-\w+]+)*)+" },
new[] { "Nop.Web.Controllers" });
routes.MapLocalizedRoute("CategoryWithManufacture",
"{SeName}-d{categoryId}/{ManufactureName}/{Color}",
new { controller = "Catalog", action = "Category", SeName = UrlParameter.Optional, Color = UrlParameter.Optional },
new { categoryId = @"\d+", SeName = @"([-\w+]+(/[-\w+]+)*)+", ManufactureName = @"([-\w+]+(/[-\w+]+)*)+", Color = @"([-\w+]+(/[-\w+]+)*)+" },
new[] { "Nop.Web.Controllers" });
: -
href="@Url.RouteUrl("CategoryWithManufacture", new { categoryId = currentCategoryId, SeName = seName, ManufactureName = manufacturerFilterItem.Name, Color = color })"
href="@Url.RouteUrl("Category", new { categoryId = currentCategoryId, SeName = seName})"
に直接値を代入する方法があります2番目のパラメータ "Color"に "ManufactureName"に値を割り当てません。意味: - (CategoryWithManufactureルートを使用)
/gloves-d18/red (second parameter)
/gloves-d18/hp/red (first and second both)
私はmanufactureNameオプションですが、我々はない二それ最初のパラメータに値を割り当てるときに、それが仕事の両方&色することにより、これらを試してみました。しかし、私たちはまず第二のパラメータに値を割り当てます。そしてそれは働かないのです。
使用可能なリンクまたはサンプルコードをお勧めします。
私のルートに変更を提案してください。 –