如果是net2.0、3.5只用在web.config中间中<system.web>节点下<pages validateRequest="false" ****就可以了
但是如果您使用的是.NET 4.0,你会发现这一操作后,仍然无效。
非常抱歉,因为.NET 4.0做了改变,需要在你的Web.config 中,在<system.web>节点下增加
| <httpRuntime requestValidationMode="2.0"/> |
这时就可以啦。
实例:
| <system.web> <httpRuntime requestValidationMode="2.0"/> <httpModules> </httpModules> <pages validateRequest="false" enableEventValidation="false" enableViewStateMac="false" viewStateEncryptionMode="Never" /> <compilation defaultLanguage="C#" debug="false" /> <authentication mode="Forms" /> <customErrors mode="Off"> <error statusCode="404" redirect="/error404.html" /> </customErrors> <globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="utf-8" /> </system.web> |