你好,我在我的项目中设置了ELMAH,但是我遇到了很多错误
System.Web.HttpException: A potentially dangerous Request.Path value
was detected from the client (:).Generated: Sun,26 May 2013 21:46:30 GMT
System.Web.HttpException (0x80004005): A potentially dangerous
Request.Path value was detected from the client (:). at
System.Web.HttpRequest.ValidateInputIfrequiredByConfig() at
System.Web.HttpApplication.PipelinestepManager.ValidateHelper(HttpContext
context)
我想忽略它们,不要发送到我的邮件,但写入ELMAH DB.
有可能吗?
解决方法
是的,您可以使用ELMAH中的
error filtering,哪个是
described in detail on the project wiki.总之,web.config中的以下过滤器应该执行此操作(假设您已经设置了模块配置部分):
<errorFilter> <test> <and> <regex binding="FilterSourceType.Name" pattern="mail" /> <regex binding="Exception.Message" pattern="(?ix: \b potentially \b.+?\b dangerous \b.+?\b value \b.+?\b detected \b.+?\b client \b )" /> </and> </test> </errorFilter>
第一个<正则表达式>条件filters based on the filtering source,使邮寄不会发生. Check out the documentation on the wiki for full details.
原文地址:https://www.jb51.cc/aspnet/249796.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。