WebServcies 调用方法异常:System.Web.HttpRequestValidationException: 从客户端中检测到有潜在危险的 Request.Form 值。...

文章详细介绍了在Web.config配置文件中通过向<httpRuntime>节点添加requestValidationMode属性来解决WebServices页面调试中检测到的潜在危险Request.Form值问题的方法,提供了解决方案并链接了相关教程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我在做WebServcies时,页面调试,报类了下面这样的错误信息:

System.Web.HttpRequestValidationException: 从客户端(checkXML="<?xml version="1.0" ...")中检测到有潜在危险的 Request.Form 值。
   在 System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection)
   在 System.Web.HttpRequest.<>c__DisplayClass5.<ValidateHttpValueCollection>b__3(String key, String value)
   在 System.Web.HttpValueCollection.EnsureKeyValidated(String key)
   在 System.Web.HttpValueCollection.Get(String name)
   在 System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection)
   在 System.Web.Services.Protocols.HtmlFormParameterReader.Read(HttpRequest request)
   在 System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
   在 System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

百度后,获得解决方案:

在Web.config配置文件中,向节点<httpRuntime> 里添加属性 requestValidationMode="2.0",即可解决问题。(其实,requestValidationMode的值只要是4.0以下都可以。具体原因,百度搜索validateRequest="false" 设置无效 有帖子回答这个问题,这里就不说明原因了。)

 

参考:http://www.cnblogs.com/vingi/articles/2478134.html

转载于:https://www.cnblogs.com/lishidefengchen/p/4735930.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值