Edit

Share via


HttpRuntimeSection.MaxQueryStringLength Property

Definition

Gets or sets the maximum possible length, in number of characters, of a query string in an HTTP request.

public:
 property int MaxQueryStringLength { int get(); void set(int value); };
[System.Configuration.ConfigurationProperty("maxQueryStringLength", DefaultValue=2048)]
[System.Configuration.IntegerValidator(MinValue=0)]
public int MaxQueryStringLength { get; set; }
[<System.Configuration.ConfigurationProperty("maxQueryStringLength", DefaultValue=2048)>]
[<System.Configuration.IntegerValidator(MinValue=0)>]
member this.MaxQueryStringLength : int with get, set
Public Property MaxQueryStringLength As Integer

Property Value

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

Attributes

Remarks

The value of the MaxQueryStringLength property can be any integer, zero or greater. If the length of a query string exceeds the size limit, ASP.NET returns an HTTP 400 (Bad Request) status code.

Note

Extremely small values can make a web site unusable.

You can set this value in a configuration file by setting the maxQueryStringLength attribute of the httpRuntime element. For more information, see httpRuntime Element (ASP.NET Settings Schema).

Note

There is also an IIS setting that controls query string length. See the maxQueryString attribute in Request Limits <requestLimits>.

Applies to