Public Class ModelBinder
Implements IModelBinder
Function BindModel(controllerContext As ControllerContext, bindingContext As ModelBindingContext) As Object
Dim request = controllerContext.RequestContext.HttpContext.Request
Dim formUpload = request.Files.Count > 0
' find filename
Dim xFileName = request.Headers("X-File-Name")
Dim qqFile = request("qqfile")
Dim formFilename = If(formUpload, request.Files(0).FileName, Nothing)
Dim upload = New FineUpload() With { _
.Filename = If(xFileName, If(qqFile, formFilename)), _
.InputStream = If(formUpload, request.Files(0).InputStream, request.InputStream) _
}
Return upload
End Function
End Class
这句话怎么总是报错?
错误 2 Class“ModelBinder”必须为接口“System.Web.Mvc.IModelBinder”实现“Function BindModel(controllerContext As ControllerContext, bindingContext As ModelBindingContext) As Object”。 C:\Users\KYO\Documents\Visual Studio 2012\Projects\MvcApplication3\MvcApplication3\Models\FineUpload.vb 25 24 MvcApplication3
------解决思路----------------------
你忘记写 Implements .IModelBinder.BindModel了