0

I am trying to write a rewrite rule in IIS 8.5 that throws 404 error when a string is found in the URL.

My current rule

        <rule name="BlockscheduledJobs-Rule2" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*scheduledJobs*" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
            <action type="CustomResponse" statusCode="404" statusReason="Error" statusDescription="Error" />
        </rule>

This rule works fine when the URL format is like

https://www.example.com/scheduledJobs/test.aspx

but doesn't work when it is like

https://www.example.com/index.aspx?task=scheduledJobs.test.run.aspx&value=job&result=true

how can i get my rule working for below URL format

user1550159
  • 1,197
  • 3
  • 19
  • 36

1 Answers1

0

Modifying the rule as mentioned below fixed my issue.

<rule name="BlockscheduledJobs-Rule2" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*scheduledJobs.*" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
            <action type="CustomResponse" statusCode="404" statusReason="Error" statusDescription="Error" />
        </rule>
user1550159
  • 1,197
  • 3
  • 19
  • 36