AllowHtml attribute not working

后端 未结 4 746
粉色の甜心
粉色の甜心 2020-12-06 07:38

I have a model with this property:

     [AllowHtml]
     [DisplayName(\"Widget for Table\")]
     [StringLength(1000, ErrorMessage = \"Maximum chars 1000\")]         


        
4条回答
  •  鱼传尺愫
    2020-12-06 08:15

    I also had this issue. I could not get a model property marked with [AllowHtml] to actually allow HTML, and instead encountered the same error you describe. My solution ended up being to mark the Controller action that accepts the posted model with the [ValidateInput(false)] attribute.

提交回复
热议问题