1

in MVC3, is route data always in the modelState collection, or is it only in the modelState collection if that key is specifically requested as per the model binder for the applicable controller action ?

To illustrate:

public HomeController { ActionResult Index(string id)

Home/Index/5?something=else

Would the modelState dictionary have the key something and value else, or would it only have the key id?

4

1 回答 1

2

它仅在ModelState它是操作方法参数的一部分时出现。要获取其他路由信息,您需要查看控制器的RouteData属性。

于 2011-12-09T14:42:23.283 回答