im begginer in asp.net mvc
i write this rout code
routes.MapRoute(
name: "test",
url: "test/{name}",
defaults: new { controller = "Home", action = "test"}
);
and this controller
public ActionResult test(string data)
{
switch (data)
{
case "test1":
return View("test1");
case "test2":
return View("test2");
case "test3":
return View("test3");
default:
return View("test1");
}
}
and in my url http://localhost:3598/test/test1
but i get null data in parameter in controller
how i can get 'test1' in switch (data) ?
thank you for your help
Aucun commentaire:
Enregistrer un commentaire