1.在页面aspx中

<%@ Page  ValidateRequest="false" >

2.在controller中action添加。

[ValidateInput(false)]
public ActionResult Edit()

{

this.ValidateRequest = false;

retrun View();

}

3.在网站web.config

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

</system.web>

在.net 4.0 环境下请求验证范围扩大到所有请求。从BeginRequest阶段就开始HttpRequest,不仅仅是页面文件(.aspx),还包含webservice以及http Handlers。

1.在页面aspx中

<%@ Page  ValidateRequest="false" >

2.在controller中action添加。

[ValidateInput(false)]
public ActionResult Edit()

{

this.ValidateRequest = false;

retrun View();

}

3.在网站web.config

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

</system.web>

在.net 4.0 环境下请求验证范围扩大到所有请求。从BeginRequest阶段就开始HttpRequest,不仅仅是页面文件(.aspx),还包含webservice以及http Handlers。

相关文章:

  • 2022-01-25
  • 2021-09-10
  • 2021-11-15
  • 2021-12-12
猜你喜欢
  • 2021-10-16
  • 2022-12-23
  • 2021-07-16
  • 2021-06-27
  • 2022-01-24
  • 2021-06-21
相关资源
相似解决方案