Reputation: 109
I'm using asp.net mvc2 and I want to implement a rich text area, and passing the contents in this textarea to controller. However, I found that since the contents of rich text area contains html tags, such as "
", it cannot be passed to controller. If I remove this html tags using regex expression, everything works well.
what can I do to pass these contents containing html tags to controller?
Upvotes: 3
Views: 4160
Reputation: 2030
2 ways you can do in this case
+ Put some line of configuration into the web.config
file
<configuration>
<system.web>
<pages validateRequest="false" />
<httpRuntime requestValidationMode="2.0" />
</system.web>
<configuration>
[ValidateInput(false)]
) onto the action that you want to posting back on the server sidepublic class DummyController : Controller { [ValidateInput(false)] public ActionResult Save(FormData formData) { return View(); } }
Upvotes: 11