0

Rewriter section is defined as follows: <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />

Then the <rewriter> element looks like that:

<rewriter>
    <if header="Host" match="^example.com">
      <redirect url="~/(.*)" to="http://www.example.com/$1" />
    </if>
    <!-- some other rules -->
</rewriter>

Now, I have roughly 2000 urls that I need to redirect to some other domain. My Web.config file is big enough on its own but when I've put those 2000 urls into it, I got: Cannot read configuration file because it exceeds the maximum file size error message. If I'd put this data into some other config file, then how can I reference it from Web.config?

My app is running on ASP.NET 2.0 and uses this package: https://www.nuget.org/packages/Intelligencia.UrlRewriter for url rewriting.

Marek M.
  • 3,799
  • 9
  • 43
  • 93
  • That topic should help you http://stackoverflow.com/questions/4470761/separate-config-file-for-sections-of-web-config – Nigrimmist Aug 08 '16 at 12:38
  • Unfortunatelly it won't. As I mentioned - I'm working with legacy code (ASP.NET 2) and the original authors decided to use this package: https://www.nuget.org/packages/Intelligencia.UrlRewriter for url rewrites. – Marek M. Aug 08 '16 at 12:39

1 Answers1

0

As a variant you can change max size for web.config by tuning registry :)

HKLM\SOFTWARE\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB  (REG_DWORD)

Note If you configure IIS 7.0 and IIS 7.5 to run in 32-bit mode on Windows Server 2008 x64 or on Windows Server 2008 R2 x 64, the registry key is instead the following:

HKLM\SOFTWARE\Wow6432Node\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB (REG_DWORD)
Nigrimmist
  • 10,289
  • 4
  • 52
  • 53
  • I'd rather go with separate files, however if I won't be able, then I'll probably go with your creative approach ;). – Marek M. Aug 08 '16 at 12:45
  • Your comment pointed me in the right direction, because I found this: http://stackoverflow.com/questions/11824596/using-external-config-file-for-urlrewriter-net . However, I can't accept your comment as an answer, so I'll just accept this one :). – Marek M. Aug 08 '16 at 12:58