HttpRuntimeSection.MaxUrlLength Property

.NET Framework (current version)

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

Namespace:   System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)

[ConfigurationPropertyAttribute("maxUrlLength", DefaultValue = 260)]
[IntegerValidatorAttribute(MinValue = 0)]
public int MaxUrlLength { get; set; }

Property Value

Type: System.Int32

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 larger.


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).

.NET Framework
Available since 4.0
Return to top