Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL rewrite - web.config error

Tags:

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

like image 213
Murali Bala Avatar asked Nov 15 '09 20:11

Murali Bala


People also ask

How do I fix the URL Rewrite module in IIS?

IIS Rewrite Module ProblemUninstall the Rewrite Module from Windows Features. Go to the Web Platform Installer. Pick Url Rewrite from Products | Server section and install. Restart IIS.

How do I disable URL Rewrite in IIS?

Open Internet Information Services (IIS) Manager > Servername > Sites > example.com > URL rewrite. Select each rewrite rule and disable them by clicking on Disable Rule.


1 Answers

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> 
like image 113
Phaedrus Avatar answered Oct 02 '22 12:10

Phaedrus