I am not sure what I am doing wrong with Xval and remote Validation


I been going through this tutorial and it looks really good. So I went through it and downloaded the sample file.

I been playing around with it and I understand how to use it and was able to add my own validation too it.

So I decided to add it to my current project I am working on. I was able to get it to compile and run yet when I try my form no validation(both client side and server side) happens.

I don't know why. So I made a another project and tried to add all the stuff again yet I don't know what I am missing it does not work.

This is the only real way I can show you theirs too many files to copy and paste the code around.

I am not even using the remote validation part for my tests yet too. I am only using like straight stuff from xval like the one thing I had is "Required Email".

Edit now I get an error

System.IO.FileNotFoundException was unhandled by user code
  Message="Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."
  FileName="System.ComponentModel.DataAnnotations, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  FusionLog="=== Pre-bind state information ===\r\nLOG: User = CHOBO2\\chobo\r\nLOG: DisplayName = System.ComponentModel.DataAnnotations, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35\n (Fully-specified)\r\nLOG: Appbase = file:///I:/OnlineV2/trunk/Current Site/\r\nLOG: Initial PrivatePath = I:\\OnlineV2\\trunk\\Current Site\\bin\r\nCalling assembly : Online.com, Version=, Culture=neutral, PublicKeyToken=null.\r\n===\r\nLOG: This bind starts in default load context.\r\nLOG: Using application configuration file: I:\\OnlineV2\\trunk\\Current Site\\web.config\r\nLOG: Using machine configuration file from C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.\r\nLOG: Post-policy reference: System.ComponentModel.DataAnnotations, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\nLOG: The same bind was seen before, and was failed with hr = 0x80070002.\r\n"
       at Microsoft.Web.Mvc.DataAnnotations.DataAnnotationsModelBinder.GetTypeDescriptor(Object model, Type modelType)
       at Microsoft.Web.Mvc.DataAnnotations.DataAnnotationsModelBinder.GetModelProperties(ControllerContext controllerContext, ModelBindingContext bindingContext) in I:\OnlineV2\trunk\Current Site\Models\DataAnnotationsModelBinder\DataAnnotationsModelBinder.cs:line 35
       at System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext)
       at System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model)
       at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
       at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
       at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor)
       at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
       at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
asked on Stack Overflow Aug 8, 2009 by chobo2 • edited Mar 3, 2019 by Cœur

2 Answers


Have you read the error closely? It looks like a file can't be found. I'm surprised it'd even compile, but I don't know much about file referencing. This error is on your testing box, and not after you publish it to another machine?

I'd start with removing it from your references and re-adding it.

Apparently DataAnnotations requires .NET 3.5SP1, but you should have that if you're even marginally up-to-date.

answered on Stack Overflow Aug 8, 2009 by James S

I had a similar issue. I downloaded the Data Annotations Model Binder Sample, built, and referenced the new assemblies in my project. Worked like a charm.

answered on Stack Overflow Sep 15, 2009 by newslacker

User contributions licensed under CC BY-SA 3.0