Iis – Does IIS Request Filtering Rules use Regex for the deny strings

iisrequest-filteringuseragent

I'm trying to block user-agent X (literally, just "X") in IIS using Request Filtering Rules. We've done this in the past for other more specific user-agents without problems.
However, now that the deny string is only an X I wonder: Are deny-strings regular expressions? Would it take ^X$?

Best Answer

I just tested this with localhost and fiddler/cURL.

The denyStrings entries are not considered as regex, but use a simple string search. Looks like there is no way with request filtering to block only user-agent X without blocking every user-agent that contains X or x.

You could use the URL rewriting module, if the request makes it that far. I'm looking to block requests at IIS level because the reqeust are invalid and raise exceptions in the ASP.NET stack.

(Very late to answer, but I was looking for this myself.)

Related Topic