I have a controller insert
action:
<AcceptVerbs(HttpVerbs.Post)> _
Function InsertObject(<Bind(Exclude:="Id")> <ModelBinder(GetType(CustomModelBinder))> ByVal object As SomeObject) As ActionResult
End Function
And i have a CustomModelBinder
class with a BindModel
implementation:
Public Function BindModel( _
ByVal controllerContext As System.Web.Mvc.ControllerContext, _
ByVal bindingContext As System.Web.Mvc.ModelBindingContext) As Object Implements System.Web.Mvc.IModelBinder.BindModel
For Each s In HttpContext.Current.Request.Form.Keys
HttpContext.Current.Response.Write(s & ": " & HttpContext.Current.Request.Form(s) & "<br />")
Next
HttpContext.Current.Response.End()
End Function
As you can see I have a controllerContext
and a ModelBindingContext
available.
How do I get the: <Bind(Exclude:="Id")>
part inside the BindModel
implementation?