URL rewrite – web.config error

I am getting the following error when i run my .aspx page.

Error Code0x8007000d
The configuration section ‘rewrite’ cannot be read because it is missing a section declaration

I have a simple v.aspx page which has the following code:

Response.Write(Request(“q”))

My hosting server as IIS 7 installed with URL rewrite feature enabled (that’s what they claim)

My web.config file has the following lines under :

Note: The node has blue squiggly lines under it

<rewrite>
      <rules>
        <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
          <match url="^([^/]+)/?$" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="v.aspx?q={R:1}" />
        </rule>
      </rules>
    </rewrite>

I have searched stackoverflow but did not find a solution.

May be someone found a solution.

TIA

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Make sure your <rewrite> is enclosed in the <system.webServer></system.webServer> section.

<configuration>
   <system.webServer>
       <rewrite>
          <rules>
             <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
             <match url="^([^/]+)/?$" />
             <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="v.aspx?q={R:1}" />
             </rule>
          </rules>
        </rewrite>
    </system.webServer>
</configuration>

Method 2

Install the URL Rewrite module http://www.iis.net/download/URLRewrite and that should be sorted. It fixed my problem

Method 3

The rewrite section in system.webServer is supported in IIS7, but not IIS6. The error is likely caused by deploying this site to a server that’s only running IIS6.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x