Reputation: 71
I am using ASP.net MVC 2.0 , i have used a textarea on my View like
<%= Html.TextAreaFor(m => m.Description, 7, 35, new { @class = "bg_area normal" })%>
it shows me an exception while submitting the form after input html data like
<p><b> hello world ! </b></p>
is there any way to accept such kind of data using textarea ?
Is there any way to handle it from one place or, i have to add
[ValidateInput(false)]
to each action ?
Upvotes: 4
Views: 1195
Reputation: 8199
I am assuming you are getting
A potentially dangerous Request.Form value was detected from the client... exception. IF this is the case then you need to decorate your action result with
[ValidateInput(false)]
Upvotes: 3
Reputation: 39898
If you want to post HTML to a Controller method you need to add the [ValidateInput(false)]
attribute to your controller method.
Here is the MSDN documentation.
Upvotes: 4