ASP.NET - maxQueryStringLength

Asked By balaji on 09-Dec-11 02:08 AM
i'm getting this error

The length of the query string for this request exceeds the configured maxQueryStringLength value

i set
maxQueryStringLength=2048


can i increase more? I'm using IE
Suchit shah replied to balaji on 09-Dec-11 02:11 AM
Gets or sets the maximum possible length, in number of characters, of a query string in an HTTP request.

Property Value

Type: http://msdn.microsoft.com/en-us/library/system.int32.aspx
The maximum length of the query string, in number of characters. The default is 2048.

The value of the http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxquerystringlength.aspx property can be any integer, zero or larger. If the length of a query string exceeds the size limit, ASP.NET returns an HTTP 400 (Bad Request) status code.

Maximum URL length is 2,083 characters in Internet Explorer. Here are few links that you can refer

http://support.microsoft.com/kb/q208427/

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

http://forums.asp.net/t/1139751.aspx


Sakshi a replied to balaji on 09-Dec-11 02:15 AM

you cant increase. but as a solution you can pass the value as a string and then cast back to numeric.
dipa ahuja replied to balaji on 09-Dec-11 02:15 AM

The maximum length of the query string, in number of characters. The default is 2048

on wiki

Maximum length of Querystring is based on the browser not depend upon the asp.net.

Here is some information
Maximum length of a querystring in IE 4.0 and above is ~2048 characters
IE. 4,5,6,7, - 2,048 characters.
Opera supports - 4050 characters.
Netscape 6 supports - 2000 characters.


Firefox Supports - 6000 characters 

http://wiki.asp.net/page.aspx/1621/maximum-length-of-querystring-in-aspnet/

Riley K replied to balaji on 09-Dec-11 02:15 AM

The Maximum length of QueryString is not based on Asp.net it is based on browser.


Maximum length of a querystring in IE 4.0 and above is ~2048 characters
IE. 4,5,6,7, - 2,048 characters.
Opera supports - 4050 characters.
Netscape 6 supports - 2000 characters.



Regards
Jitendra Faye replied to balaji on 09-Dec-11 03:58 AM

When an unauthorized request comes in, the entire request is URL encoded, and added as a query string to the request to the authorization form, so I can see where this may result in a problem given your situation.

According to MSDN, the correct element to modify to reset maxQueryStringLength in web.config is the <httpRuntime> element inside the <system.web> element, see http://msdn.microsoft.com/en-us/library/e1f13641.aspx. Try modifying that element.

kalpana aparnathi replied to balaji on 09-Dec-11 04:19 AM
hi,

    you can increase the maxQueryStringLength value up to 65535 in positive number in web.config file