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


I had a problem the other day that I believe qualifies as a post. An user reported that refreshing the organization overview would generate a 404. After debugging the problem, I found out that the URL generated by that page can be too long. This post is an explanation of the error and how lớn fix it.

Bạn đang xem: The request filtering module is configured to deny a request where the query string is too long


The error

When looking at the error generated on localhost, I saw the following:


And in text:

HTTPhường Error 404.15 - Not FoundThe request filtering module is configured to deny a request where the query string is too long

When looking at the Requested URL field at the bottom of the screenshot, it is clear that the URL is long. IIS enforces some limitations in the number of characters accepted as part of the query string. As suggested by the error message, this can be fixed by modifying the maxQueryString settings in the web.config tệp tin. Let"s quickly recap the structure of an URL:

ProtocolDomainPathQuery stringFragment
https://tiện í

The error above is on the query string part, but there are other limitations as well. For the Path part, IIS also limits the number of allowed characters. This setting is named maxUrl, which doesn"t make a lot of sense (IMO) when looking at the breakdown above sầu. Both maxQueryString và maxUrl have sầu default values, as shown below:

ProtocolDomainPathQuery stringFragment
https://ứng dụ
Max length40962048

The mặc định values are quite decent & cover most scenarios. To tư vấn a very long query string (or path) as illustrated by this error, there"s an easy fix.

The fix

As you probably already guessed, the fix is lớn change the maxQueryString setting (or maxUrl if the problem is in the path). To vị so, modify the security element in the website.config file:

... ... In this example I have quadrupled the allowed number of characters in the query string.

Xem thêm: Cài Đặt Sql Server Express 2014 Trên Windows

For older websites, you need lớn change the setting as part of the element:

... ... Notice that when using the httpRuntime element khổng lồ configure max length, different default values exist. Most modern websites don"t need to worry about this, though. Error logging and Uptime Monitoring for your website apps

This post is brought khổng lồ you by is error logging, uptime monitoring, deployment tracking, and service heartbeats for your .NET and JavaScript applications. Stop relying on your users khổng lồ notify you when something is wrong or dig through hundreds of megabytes of log files spread across servers. With, we store all of your log messages, notify you through popular channels lượt thích email, Slachồng, and Microsoft Teams, và help you fix errors fast.

Chuyên mục: Domain Hosting