Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

In IIS what is the difference between rewrite rules managed by URL Rewrite Module versus those which are only in the web.config file and do not appear in the URL Rewrite Module?

Using the URL Rewrite Module in IIS 7.5 to add a rule...

I notice that the rules, when looking at the web.config, are quite readable, and they are rooted in .

In contrast, using rewrite rules via web.config not managed by the URL Rewrite module...

do not seem to be as readable (perhaps this is not true for all), and these rules are rooted in instead of .

QUESTION: What is the difference, and what are pros/cons of using each? Personally, I like the ability to use the IIS module because it gives you an interface to test rules.

Example of a rule from the IIS 7.5 Rewrite Module:

<rewrite>
        <rules>
            <rule name="LowerCaseRule1" stopProcessing="true">
                <match url="[A-Z]" ignoreCase="false" />
                <action type="Redirect" url="{ToLower:{URL}}" />
            </rule>
        </rules>
    </rewrite>

Example of a rule not managed by the IIS 7.5 Rewrite Module:

<rewriter>
    <rewrite url="^/([0-9]+)/([0-9]+)/.*.aspx$"
     to="~/ContentDisplay.aspx?CID=$1&amp;SID=$2" processing="stop" />
</rewriter>

note: I added a linebreak to the second example of code after ".aspx$"

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

From memory (I had to research this a few years ago) it has to do with what ISAPI extension is handling the redirect - what you want is something which is running in the same process space as IIS otherwise the redirection can actually slow or choke the webserver depending on the volume.

I believe that the method you describe above is performing the rewrite with asp.net rather than an ISAPI filter.

I appreciate this isn't the best answer, I hope it points you in the right direction.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.