Gaz
Gaz

Reputation: 4154

HttpModule URL rewriting using IIS6 with no extensionless URLs

We are using the Intelligencia URLRewriting module for asp.net with version 2.0 of the framework and IIS6. Our URLs typically have no extension.

I understand that IIS6 cannot really deal with this situation without a blanket wildcard (which causes other problems).

However, it works! Sometimes. At other times (e.g. on one dev's machine, and on my machine when I point a different virtual directory at the app) it doesn't. By "it doesn't work" I mean the configured HttpModules never even get hit.

Can anyone explain this?

Thanks.

Upvotes: 3

Views: 4352

Answers (4)

cqin
cqin

Reputation: 49

If you are using an IIS6 with ASP.net 4.0, you must specify and register the modules like this:

<system.web>
<httpModules>
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>

not

<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
</modules>

Upvotes: -2

Gaz
Gaz

Reputation: 4154

So it turns out what was happening was the following:

I guess this could prove to be a useful kludge for someone, but we're moving to an isapi filter. One heads-up is that this will by default lead to a tight loop of redirects!

Upvotes: 4

andynormancx
andynormancx

Reputation: 13762

Are you sure that when "it works" you aren't running under the Cassini development web server included in VS.NET ? Because extensionless wildcards do work under Cassini, which can be very confusing to say the least.

Upvotes: 1

Rune Grimstad
Rune Grimstad

Reputation: 36340

If you run a site using the Visual Studio development web server all requests will be handled by asp.net so your HttpModule will run.

On IIS6 this should not happen unless it is set up to forward the requests to asp.net.

Upvotes: 2

Related Questions