Asp。Net MVC输入验证在被禁用后仍然会启动

时间:2023-01-27 18:18:56

I've disabled validateRequest in my web.Config, but the app is still firing the error:

我在web上禁用了validateRequest。配置,但应用程序仍在触发错误:

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

一个有潜在危险的请求。从客户端检测到表单值

I've got the following in my web.Config

我在我的web.Config中有以下内容。

    <httpRuntime requestValidationMode="2.0" />
    <pages validateRequest="false">

I've also tried the following in my controller to no avail

我还在控制器中尝试了以下操作,但没有任何效果

<ValidateInput(False)> _
<AcceptVerbs(HttpVerbs.Post)> _
Function Edit(ByVal user As Domain.User, ByVal id As Integer) As ActionResult

1 个解决方案

#1


2  

Answer found Why is ValidateInput(False) not working?

答案发现为什么ValidateInput(False)不能工作?

You have to set the ValidInput in the Controller AND in the web.Config.

必须在控制器和web.Config中设置ValidInput。

    <httpRuntime requestValidationMode="2.0"/>

#1


2  

Answer found Why is ValidateInput(False) not working?

答案发现为什么ValidateInput(False)不能工作?

You have to set the ValidInput in the Controller AND in the web.Config.

必须在控制器和web.Config中设置ValidInput。

    <httpRuntime requestValidationMode="2.0"/>