ASP.NET提交表单内容项有html标签就出错的问题?

在webconfig中进行修改:

在节点httpRuntime内加入:requestValidationMode="2.0"
在节点compilation内加入:targetFramework="4.0"

即变成:这是我的配置,你只需修改上面的项就行,就是requestValidationMode="2.0"和targetFramework="4.0"。

<httpRuntime maxRequestLength="20480" executionTimeout="600"  requestValidationMode="2.0"/>
<compilation debug="false" targetFramework="4.0">
  <buildProviders>
    <add extension=".html" type="System.Web.Compilation.PageBuildProvider" />
    <add extension=".xml" type="System.Web.Compilation.PageBuildProvider" />
  </buildProviders>
</compilation>

如果.NET FrameWork版本是4.0以下的,添加<httpRuntime requestValidationMode="2.0"/>即可。

复制内容


评论


乖,登录后才可以留言! 登录

Copyright © 2020-2023 春藤技术,春藤建站 All Rights Reserved
备案号:豫ICP备20020705号 公网安备 51LA统计
0.259103s