3
Answers

i ma getting error while using ckeditor in mvc

i ma getting error while using ckeditor in mvc &nbsp;as&nbsp;<h2 style="font-family: Verdana; font-weight: normal; font-size: 14pt; color: maroon; background-color: #ffffff;"><em>A potentially dangerous Request.Form value was detected from the&nbsp;</em></h2><div>though i am write [allowhtml] in my model class it will not work&nbsp;</div>
Answers (3)
0
Vinay Singh

Vinay Singh

NA 5.9k 126.1k 8y

You have a few options.

On the model add this attribute to each property that you need to allow HTML - best choice

[AllowHtml]

On the controller action add this attribute to allow all HTML

[ValidateInput(false)]
For detail check the link
http://stackoverflow.com/questions/17254354/asp-net-mvc-a-potentially-dangerous-request-form-value-was-detected-from-the-cli
http://stackoverflow.com/questions/21672855/a-potentially-dangerous-request-form-value-was-detected-from-the-client-mvc4
Accepted
0
Rajeesh Menoth

Rajeesh Menoth

NA 24.7k 629.5k 8y
Hi,
 
Add ValidateRequest = "false" in your code.
 
Web Config :
  1. <configuration>  
  2.   <system.web>  
  3.    <httpRuntime requestValidationMode="2.0" />  
  4.   </system.web>  
  5.   <pages validateRequest="false">  
  6.   </pages>  
  7. </configuration>  
Reference Code : 
  1. [HttpPost]  
  2. [ValidateInput(false)]  
  3. public ActionResult MyMethod(string s)  
  4. {  
  5.     ....  
  6. }  
 
Reference :
 
http://www.aspsnippets.com/Articles/ASPNet-Error-A-potentially-dangerous-RequestForm-value-was-detected-from-the-client.aspx
 
http://stackoverflow.com/questions/17254354/asp-net-mvc-a-potentially-dangerous-request-form-value-was-detected-from-the-cli 
0
Midhun T P

Midhun T P

NA 19.7k 281.1k 8y
Hi,
Have you checked the below links?
http://stackoverflow.com/questions/4630962/a-potentially-dangerous-request-form-value-was-detected-from-the-client
http://r2d2.cc/2011/05/26/ckeditor-a-potentially-dangerous-request-form-value-was-detected-from-the-client/