Szworny Dziąch Szworny Dziąch - 1 year ago 92
ASP.NET (C#) Question

Loading part of web.config from other file

Rewriter section is defined as follows:

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

Then the
element looks like that:

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

Now, I have roughly 2000 urls that I need to redirect to some other domain. My
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

My app is running on ASP.NET 2.0 and uses this package: for url rewriting.

Answer Source

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)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download