Let's say I have a most basic controller
public class HomeController : Controller
{
public ActionResult Index(string id, string language)
{
return View();
}
}
Which takes in 2 parameters. However there is one requirement that the client which calls the action method should pass id
value from URL but language
value from http header. It means the url should be /Home/Index/12345
and meanwhile the calling client will set a Http Header value language : en
.
How shall I set the routing in MVC5 or MVC6 to achieve the requirement?
Please don't provide samples from Web Api.
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…