Reputation: 71
We are using WFFM with Sitecore 8 and recently have started experiencing an issue whereby any form that contains an email field causes an invalidcastexception when posting the form. If we remove the email field from the form then we can submit successfully. From the exception, it looks like somehow the email field is not being bound correctly, but I can't be certain.
Has anyone experienced anything like this? Details of the exception can be found below.
Unable to cast object of type 'System.String[]' to type 'System.String'.
Description: An unhandled exception occurred.
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.String[]' to type 'System.String'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'System.String[]' to type 'System.String'.]
Sitecore.Forms.Mvc.Validators.EmailValidatorAttribute.IsValid(Object value, ValidationContext validationContext) +92
System.ComponentModel.DataAnnotations.ValidationAttribute.GetValidationResult(Object value, ValidationContext validationContext) +41
System.Web.Mvc.<Validate>d__15.MoveNext() +264
Sitecore.Forms.Mvc.Controllers.ModelBinders.<Validate>d__1.MoveNext() +940
Sitecore.Forms.Mvc.Controllers.ModelBinders.FieldModelBinder.OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext) +392
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +999
Sitecore.Forms.Mvc.Controllers.ModelBinders.SectionModelBinder.BindFieldCollection(ControllerContext controllerContext, ModelBindingContext bindingContext, IEnumerable`1 list) +570
System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor) +441
System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext) +180
System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) +68
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +999
System.Web.Mvc.DefaultModelBinder.UpdateCollection(ControllerContext controllerContext, ModelBindingContext bindingContext, Type elementType) +569
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +976
System.Web.Mvc.DefaultModelBinder.GetPropertyValue(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor, IModelBinder propertyBinder) +33
System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor) +441
System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext) +180
System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) +68
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +999
Sitecore.Support.Forms.Mvc.Controllers.ModelBinders.FormModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +696
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +437
System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +153
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +642
Upvotes: 0
Views: 412
Reputation: 63
The problem was caused by Glimpse screwing with the model binding. The only solution I have come up with is to disable Glimpse.
Upvotes: 0