15

We've inherited an application that uses the Intelligencia.UrlRewriter module. Our environment though is IIS7. We've already set our site to run in the classic asp.net application pool (which aparantly works for a lot of these kinds of problems). However we're still not seeing the URLs in our app be rewritten.

Has anyone run into this?

hlovdal
  • 26,565
  • 10
  • 94
  • 165

4 Answers4

21

You need to define the config on the system.webServer element, like:

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

You can keep both config. What you probably have now is:

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

Check the section "Migrating ASP.NET Applications to IIS 7.0 Integrated mod" on http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis7/

ps. I have been using it with no trouble at all, as long as that config is in.

Update 1: Also check http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx, particularly "Approach 3: Using an HttpModule to Perform Extension-Less URL Rewriting with IIS7", since the config I added has the extension-less config.

eglasius
  • 35,831
  • 5
  • 65
  • 110
  • Freddy, I gave that a shot but it didn't work. I think IIS7 doesn't like the url(ex: gallery/view/1 ) being extensionless. Can regex fix this? Here's current: –  Mar 05 '09 at 17:01
  • hmm, I haven't used that style of config, mine looks like this: – eglasius Mar 05 '09 at 17:47
  • I don't have extra query parameters, and other stuff though. Anyway I would try it with a simple version first, to rule out anything with that config. – eglasius Mar 05 '09 at 17:51
  • Is there a way that I can get it to work with "Classic" pipeline? – Hiyasat Nov 13 '12 at 09:49
  • @Hiyasat the second snippet should make it work on the 'classic' pipeline, but just not for extension less paths. You need some extra configuration for it, but I don't have a link at hand. – eglasius Nov 22 '12 at 07:57
  • 1
    Entries mentioned above under the system.webServer and httpModules worked for me for Integrated mode (IIS7.5) – Rahatur Feb 13 '13 at 11:19
1

I have spotted the same problem, after few tries I found out that changing asp mode to integrated pipeline helped.

kliszaq
  • 1,086
  • 8
  • 9
1

Don't forget to add the following lines in the system.webServer section of your web.config file if you are using IIS7

<system.webServer>
<modules runAllManagedModulesForAllRequests=”true”>
<add name=”UrlRewriter” type=”Intelligencia.UrlRewriter.RewriterHttpModule” />
</modules>
<validation validateIntegratedModeConfiguration=”false” />
</system.webServer>

As in

http://frozengraphics.wordpress.com/2009/12/06/intelligencia-urlrewriter-and-iis7/

Adamy
  • 2,789
  • 3
  • 27
  • 25
1

Yes I had the exact same problem with Intelligencia.UrlRewriter module, running under Win Vista & IIS7, however switching to the classic asp.net app pool did fix the problem. Are you running the app in a new virtual directory? That can sometimes mess with the root path to the application which could make a difference to the rules in the web.config

Nick Allen
  • 11,970
  • 11
  • 45
  • 58