Friday, November 7, 2014

A potentially dangerous Request.Form value was detected from the client error In MVC

I got this error when i have submited Html.Begin Form in MVC Razor, for that i have used ckeditor biding with Description field in model and when i have content with enter or new line i got this error.

You have to check below options when you got this error.

[AllowHtml]
The model add this attribute for each property that you want allow HTML.

[ValidateInput(false)]
This attribute will add above controller action to allow HTML.

You should do also some settings in Web.config file 

This settings which is related in HttpRuntime and pages according to requestValidationMode="2.0" and validateRequest="false" attribute in the pages element.


I think this settings will help you to find out this problem solutions. if you have still any error or confusion regarding this question leave here your comment or email me at mehulpatelk152@gmail.com

1 comment:

  1. for [AllowHtml] you need to add System.Web.Mvc namespace in your model.

    ReplyDelete