some_bloody_fool some_bloody_fool - 1 year ago 96
C# Question

How to configure the web.config to allow requests of any length

I am building a site in which i would like to create a file client side from the value of a textarea element.

I have the code in place to do this, but i am getting this error

HTTP Error 404.15 - Not Found The request filtering module is
configured to deny a request where the query string is too long.

Is there a way to override this so that I am able to process requests of any size?

If not, is there a way to generate files client side without using the filesystem/active x object?


Answer Source

Add the following to your web.config:

      <requestLimits maxQueryString="32768"/>


Updated to reflect comments.

requestLimits Element for requestFiltering [IIS Settings Schema]

You may have to add the following in your web.config as well

 <httpRuntime maxQueryStringLength="32768" maxUrlLength="65536"/>

See: httpRuntime Element (ASP.NET Settings Schema)

Of course the numbers (32768 and 65536) in the config settings above are just examples. You don't have to use those exact values.