简体   繁体   中英

Placing web.config redirects in a seperate file

The following post claims it's possible to place all web.config httpRedirect in a separate file however when I follow the instructions in the post I get:

HTTP Error 500.19 - Internal Server Error
Config Error    configSource must exist alone in an element 

What my web.config looks like:

<configuration>
  <system.webServer>
    <httpRedirect enabled="true" configSource="WebRedirects.config" ></httpRedirect>
  </system.webServer>
</configuration>

What my WebRedirects.config looks like (obviously the dots represent multiple entries):

<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Permanent">
     <add wildcard="/folder/file.aspx" destination="/another-folder/another-file.aspx" />
     .
     .
     .
</httpRedirect>

Argh, I saw the problem as soon as I posted it. Needed to remove the enable="true" attribute. So it becomes:

<configuration>
  <system.webServer>
    <httpRedirect configSource="WebRedirects.config" ></httpRedirect>
  </system.webServer>
</configuration>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM