Share via

HttpRuntimeSection.MaxUrlLength Property


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

 property int MaxUrlLength { int get(); void set(int value); };
[System.Configuration.ConfigurationProperty("maxUrlLength", DefaultValue=260)]
public int MaxUrlLength { get; set; }
[<System.Configuration.ConfigurationProperty("maxUrlLength", DefaultValue=260)>]
member this.MaxUrlLength : int with get, set
Public Property MaxUrlLength As Integer

Property Value

The length of the URL, in number of characters. The default is 260.



The value of the MaxUrlLength property can be any integer, zero or greater.


Extremely small values can make a Web site unusable.

If the length of the request URL (which is the value of the Path property) exceeds the configured size limit, ASP.NET returns an HTTP 400 (Bad Request) status code

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

Applies to