Reputation: 21328
I have a custom type in my model like so:
[StringLength(1000, MinimumLength = 150, ErrorMessageResourceName = "fld_Description_val_MinLength_lbl", ErrorMessageResourceType = typeof(Resources.Service.Controllers.Firm))]
[AllowHtml]
[Display(Name = "fld_Description_lbl", ResourceType = typeof(Resources.Service.Controllers.Firm))]
public MultilanguageProperty<string> Description
{
get
{
return this.GetMultilanguageProperty("Description", string.Empty, this);
}
set
{
this.SetMultilanguageProperty("Description", value);
}
}
for some reason AllowHtml does not work on custom types (A potentially dangerous Request.Form value was detected from the client). How would i get around it? thanks
Upvotes: 0
Views: 577
Reputation: 24125
What AllowHtml does is setting RequestValidationEnabled = false on Metadata, it doesn't containst any type specific logic. The most probable reason here is name mismatch between your property and the value in POST form collection (ValueProvider doesn't see this property Metadata as Metadata for posted value). You can disable validation for entire request by putting [ValidateInput(false)] on your action.
Upvotes: 2