Solution for Query String Too Long Error

I came across an error related to the long query string in a website.

Request URL Too Long

HTTP Error 414. The request URL is too long.

HTTP Error 404.15 – Not Found

The request filtering module is configured to deny a request where the query string is too long.

The error is due to long query sting. By default the maximum query string length(maxQueryString) accepted by IIS is 2048. IIS throws this error for any query string in the url exceeding this limit. It’s always a good practice to avoid long query strings in a asp.net websites. But in case if needed we can change the IIS settings to accept long query strings. Microsoft has a very good documentation on this settings. Try the settings to avoid the “query string too long” error in your browser. This workaround is applicable for IIS 6.0, 7.0 and 7.5. Another workaround is to change the maxQueryString and the maxUrl value for the website. Read more about Changing maxQueryString and maxUrl.

See this article for few of the best practices you can follow while generating query string in .Net web applications.

Refer: http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits.

Leave your thoughts...