Cristian Boariu
Cristian Boariu

Reputation: 9621

Unrecognized configuration section rewriter

I'm trying to implement Approach 3 from this Url Rewriting article.

I've added all the required configuration (in web.config for the UrlRewriter module) but when i try to add this in web.config:

<configuration>
    <configSections>
    <sectionGroup>
    <section name="rewriter"  
             requirePermission="false" 
             type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
  </sectionGroup>
  </configSections>

  <system.web>

    <httpModules>
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
    </httpModules>
  </system.web>
  <rewriter>
     <rewrite url="~/products/(.+)" to="~/products.aspx?category=$1" />
  </rewriter>
</configuration>

it gives me:

Unrecognized configuration section rewriter...

Please let me know me WHY it tells me that i put in the wrong place that rewriter xml node?

Thanks...

Solution: I've put section node under sectionGroup while it has to be directly under configSections

Upvotes: 1

Views: 5345

Answers (2)

Anand Thangappan
Anand Thangappan

Reputation: 3106

I solve this issue check the configSections place. rewriter should be outside of sectiongroup.

like that:

<configSections>
        <section name="rewriter"  
                 requirePermission="false" 
                 type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
      </configSections>

Its working i checked with my project.

Upvotes: 0

ggonsalv
ggonsalv

Reputation: 1262

You are missing the config section so .Net can NOT parse the actual setting

 <rewriter>
   <rewrite url="~/products/(.+)" to="~/products.aspx?category=$1" />
 </rewriter>

IF read the link you posted the rewriter is no contained in the section but it is seperate.

Upvotes: 0

Related Questions