0

I have text field that may contain html text (like

<b>Dickens</b>

) in razor view, I display this field with

@Html.TextAreaFor(m => m.CurrentAuthor.AboutAuthorE)

when click in any submit buttons, mvc3 throw exception

A potentially dangerous Request.Form value was detected from the client (CurrentAuthor.AboutAuthorE="<div align=justify><...").

how can I solve this error?

Hala Aly
  • 141
  • 2
  • 13
  • can it be something like this post? http://stackoverflow.com/questions/7774161/ie-only-a-potentially-dangerous-request-form-value-was-detected-from-the-clien – A.B.Cade Jan 12 '12 at 07:55
  • 1
    or this http://stackoverflow.com/questions/7218807/dynamic-html-content-a-potentially-dangerous-request-form-value-was-detected – A.B.Cade Jan 12 '12 at 07:57
  • Thanks A.B.Cade your links was very helpfull, I found the answer in http://stackoverflow.com/questions/81991/a-potentially-dangerous-request-form-value-was-detected-from-the-client – Hala Aly Jan 12 '12 at 08:24

1 Answers1

3

If you need to store basic formatting consider bbcode

www.bbcode.org

A good editor is Markdown http://en.wikipedia.org/wiki/Markdown

If you do require more than the basic formatting that something like Markdown can give you consider adding the AllowHtml attribute to your model

[AllowHtml] 
public string AboutAuthorE { get; set; }

for details see A potentially dangerous Request.Form value was detected from the client

Community
  • 1
  • 1
NinjaNye
  • 7,046
  • 1
  • 32
  • 46