Bind[Exclude|Include]排除字段或只允许字段验证

1  public ActionResult xx([Bind(Exclude = "id")] xxModel xx, HttpPostedFileBase file)//排除id验证
2 
3 //Bind(Include="name,age") 只允许name和age验证

 

ModelState.Remove("Name")//另一种排除验证方式


      

posted @ 2015-07-15 16:10  X-Jonney  阅读(719)  评论(0)    收藏  举报