Condividi tramite


HttpWebRequest.AllowWriteStreamBuffering Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

When overridden in a descendant class, gets or sets a value that indicates whether to buffer the data written to the Internet resource.

Namespace:  System.Net
Assembly:  System.Net (in System.Net.dll)

Syntax

'Declaration
Public Overridable Property AllowWriteStreamBuffering As Boolean
public virtual bool AllowWriteStreamBuffering { get; set; }

Property Value

Type: System.Boolean
true to enable buffering of the data written to the Internet resource; false to disable buffering. The default is true.

Exceptions

Exception Condition
NotImplementedException

This property is not implemented.

NotSupportedException

This property cannot be set to false on the browser stack.

Remarks

When AllowWriteStreamBuffering is true, the data is buffered in memory so it can be written more efficiently to the Internet resource in larger chunks. This property provides support for determining upload progress.

The AllowWriteStreamBuffering property is supported by both the browser and client HTTP stack. However on the browser stack, the AllowWriteStreamBuffering property can only be set to true and will throw NotSupportedException if set to false.

The AllowWriteStreamBuffering property affects when the callback from BeginGetRequestStream method is called. When the AllowWriteStreamBuffering property is true, the callback is raised immediately before any data is sent. When the AllowWriteStreamBuffering property is false, the callback is raised only after the headers are sent and then all writes to the stream are immediately sent to the server.

If the application derives a class from HttpWebRequest and does not override the AllowWriteStreamBuffering property and then tries to get or set the AllowWriteStreamBuffering property, a NotImplementedException is thrown.

If an application implements a custom WebRequest class and does not override the AllowWriteStreamBuffering property, then the NotImplementedException is thrown.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.