このルートマップを定義しました。
routes.MapRoute("default", // route name
"{controller}/{action}/{id}", // url with parameters
new { controller = "home", action = "index", id = UrlParameter.Optional }, // parameter defaults
new string[] { "mobilesurveys.mt.controllers" }
);
これは完全に機能します。別のルートマップを追加したい
routes.MapRoute("couponreedem", // route name
"{controller}/{action}/{clientname}", // url with parameters
new { controller = "Rc", action = "index", id = UrlParameter.Optional }, // parameter defaults
new string[] { "mobilesurveys.mt.controllers" }
);
私はこのように定義しました。ここでRcは私のコントローラーです。そして私は.com/Rc / Rc/sammyとしてURLを与えています
およびコントローラーのメソッドは次のように定義されます
public ActionResult Rc(string clientname)
{
viewModel =dataRc.ProductCategoryGet();
return View(viewModel);
}
clientnameは常にnullになります。既存のルートが邪魔されないように別のルートを追加する方法。
ありがとう。