Error “A potentially dangerous Request.Form value was detected from the client” despite the fixes for ASP.NET MVC 2?

淺唱寂寞╮ 提交于 2019-12-13 19:15:22

问题


Using ASP.NET 4.0 and MVC 2, I have added these suggested modifications:

In the web.config -

<httpRuntime requestValidationMode="2.0"/>

To the Controller -

 <ValidateInput(False), AcceptVerbs(HttpVerbs.Post)>

To the View Page -

   <%@ Page ValidateRequest="false" %>

I still receive the exception

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

I am trying to use the MarkItUp editor in this way -

<%= Html.TextAreaFor( model => model.Description,"markitup")%>

回答1:


A work around for this issue is to set the validation mode to v2.0 instead of v4.0. To do this, add this httpRuntime line to your web.config, inside System.Web, along with using the <ValidateInput(false)> attribute

<system.web>
    <httpRuntime requestValidationMode="2.0"/>
</system.web>

I haven't found the reason yet, but this worked for me.



来源:https://stackoverflow.com/questions/2959345/error-a-potentially-dangerous-request-form-value-was-detected-from-the-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!