Asp.net mvc MVC赢得';t反序列化HttpGet变量

Asp.net mvc MVC赢得';t反序列化HttpGet变量,asp.net-mvc,parameters,action,Asp.net Mvc,Parameters,Action,当我提交此url时: http://localhost:3333/User/GetAll?_dc=1345288777353&page=1&start=1&limit=25&callback=Ext.data.JsonP.callback2 控制器不会反序列化分页模型页面。调试器显示page=null public class PagingModel { public string start { get { return _start; } set

当我提交此url时:

http://localhost:3333/User/GetAll?_dc=1345288777353&page=1&start=1&limit=25&callback=Ext.data.JsonP.callback2 
控制器不会反序列化
分页模型页面
。调试器显示
page=null

public class PagingModel
{

    public string start { get { return _start; } set { _start = value; } }
    private string _start;

}

public class UserController : Controller
{

    [HttpGet]
    public JsonResult GetAll(PagingModel page)
    {
           ///////////////////
           //page is null.
           ///////////////////
    }
}

哦,重命名您的操作参数:

[HttpGet]
public JsonResult GetAll(PagingModel model)
{
   ///////////////////
   // model is no longer null
   ///////////////////
}
这样做的原因是,您的请求中已有一个
page=1
query string参数,使得试图将值
1
反序列化为
PagingModel
的默认模型绑定器变得疯狂,这显然是很难做到的