我已经定义了属性路由,它将两个参数作为日期时间
[Route("{controller}/{action}/{*startDate:datetime}/{*endDate:datetime}")]
public bool OverView(DateTime startDate,DateTime endDate)
{
var dt = startDate.ToString("yyyy-MM-dd");
return true;
}
但不确定,怎么可能。属性路由适用于单个参数,但不确定它如何适用于 2 个参数。也很难知道它将如何从 url 中区分两个参数
单个参数工作正常
http://domain.com/Home/overview/2014/02/01
两个参数的 url 是什么?我尝试了下面的但有一个例外
http://domain.com/Home/overview/2014/02/01/2014/02/04
Exception
A catch-all parameter can only appear as the last segment of the route URL.
Parameter name: routeUrl