This topic has not yet been rated Rate this topic

HttpRuntimeSection.RequestLengthDiskThreshold Property

Gets or sets the input-stream buffering threshold.

Namespace:  System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)
[ConfigurationPropertyAttribute("requestLengthDiskThreshold", DefaultValue = )]
[IntegerValidatorAttribute(MinValue = )]
public int RequestLengthDiskThreshold { get; set; }

Property Value

Type: System.Int32
The number of bytes that indicate the input-stream buffering threshold. The default is 80 kilobytes.
Exception Condition
ConfigurationErrorsException

The selected value is greater than MaxRequestLength.

The RequestLengthDiskThreshold property specifies the input-stream buffering threshold limit in number of bytes. Its value should not exceed the MaxRequestLength property value. After a request entity exceeds this threshold, it is buffered transparently onto disk.

The following example shows how to use the RequestLengthDiskThreshold property.


// Get the RequestLengthDiskThreshold property value.
Response.Write("RequestLengthDiskThreshold: " +
  configSection.RequestLengthDiskThreshold + "<br>");

// Set the RequestLengthDiskThreshold property value to 512 bytes.
configSection.RequestLengthDiskThreshold = 512;


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(2000 characters remaining)
Community Content Add
Annotations FAQ
Regarding above comments
@TxITGuy: I'd think KB would be more reasonable value here, as when I'm writing at 1KB buffer (i.e.: writing 1KB of data in each write), I found it slow, but when using 64KB buffer, the performance becomes acceptable. If you're writing web server, you'll want to process memory hogging requests as fast as it should be. However, it seems documentation for v2 and 3 is consistant on agreeing it 256 bytes.

@Martin: It seems that the 80KB default value is for .NET v3.5 and 4. If you change the dropdown of that page to target .NET v2 or 3.0, it shows 256 bytes there. So it's documentation change not propagated to other relevent places.

Also conflicts with HttpPostedFile documentation
It gets even more confusing, as this page says the default is 256K, rather than 256 bytes:

http://msdn.microsoft.com/en-us/library/system.web.httppostedfile.aspx

Perhaps the value means different things to different classes?
Inconsistent information
According to this page:
The number of bytes that indicate the input-stream buffering threshold. The default is 256 bytes.

According to http://msdn.microsoft.com/en-us/library/e1f13641.aspx:
Specifies the limit for the input stream buffering threshold, in kilobytes. The default is 80 KB.

Which one is true?