Filtering HttpException: A potentially dangerous Request.Path value was detected...

1,335 views
Skip to first unread message

Brett

unread,
Dec 16, 2011, 4:31:06 PM12/16/11
to ELMAH
We see this exception come through periodically and I would like to
suppress it. Can anyone tell me how I could do this in the web.config?

System.Web.HttpException (0x80004005): A potentially dangerous
Request.Path value was detected from the client

I've seen the example for suppressing 404 errors and we use that, but
this one doesn't have an HttpStatusCode.

Ideas?

Atif Aziz

unread,
Dec 17, 2011, 8:59:18 AM12/17/11
to el...@googlegroups.com
You could filter such an exception based on the message content since it doesn't have any other sufficiently unique properties (type, HRESULT and so on). In the example below, the message is matched against a regular expression that looks for the words potentially, dangerous, value, detected and client and in the mentioned sequence.
 
<errorFilter>
    <test>
        <regex binding="Exception.Message"
               pattern="(?ix: \b potentially \b.+?\b dangerous \b.+?\b value \b.+?\b detected \b.+?\b client \b )" />
    </test>
</errorFilter>
 
This should help filter an exception where the message reads "A potentially dangerous Request.Path value was detected from the client". You could add or removed more words or condition depending on how specific or board you want the match to be.
 
- Atif

--
You received this message because you are subscribed to the Google Groups "ELMAH" group.
To post to this group, send email to el...@googlegroups.com.
To unsubscribe from this group, send email to elmah+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/elmah?hl=en.


Brett

unread,
Dec 19, 2011, 12:16:44 PM12/19/11
to ELMAH
That did the trick Atif. Thank you.
Reply all
Reply to author
Forward
0 new messages