protected override object GetPropertyValue(ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext,
                                            PropertyDescriptor propertyDescriptor, System.Web.Mvc.IModelBinder propertyBinder)
 {
     try
     {
         return(base.GetPropertyValue(controllerContext, bindingContext, propertyDescriptor, propertyBinder));
     }
     catch (HttpRequestValidationException e)
     {
         HandleHttpRequestValidationException(bindingContext, e);
         return(null); // Encode here
     }
 }
        protected override object GetPropertyValue(ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext,
                                                   PropertyDescriptor propertyDescriptor, System.Web.Mvc.IModelBinder propertyBinder)
        {
            var propertyType = propertyDescriptor.PropertyType;

            if (propertyType == typeof(DateTime) || propertyType == typeof(DateTime?))
            {
                var providerValue = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
                if (null != providerValue)
                {
                    DateTime date;
                    if (DateTime.TryParseExact(providerValue.AttemptedValue, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
                    {
                        return(date);
                    }
                }
            }
            return(base.GetPropertyValue(controllerContext, bindingContext, propertyDescriptor, propertyBinder));
        }