HttpRuntimeSection.MaxRequestLength Egenskap

Definition

Hämtar eller anger den maximala begärandestorleken.

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

Egenskapsvärde

Den maximala begärandestorleken i kilobyte. Standardstorleken är 4 096 KB (4 MB).

Attribut

Undantag

Det valda värdet är mindre än RequestLengthDiskThreshold.

Exempel

I följande exempel visas hur du hämtar det aktuella MaxRequestLength egenskapsvärdet.

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

// Set the MaxRequestLength property value to 2048 kilobytes.
configSection.MaxRequestLength = 2048;
' Get the MaxRequestLength property value.
Response.Write("MaxRequestLength: " & _
  configSection.MaxRequestLength & "<br>")

' Set the MaxRequestLength property value to 2048 kilobytes.
configSection.MaxRequestLength = 2048

Kommentarer

Egenskapen MaxRequestLength anger gränsen för bufferttröskelvärdet för indataströmmen. Den här gränsen kan till exempel användas för att förhindra överbelastningsattacker som orsakas av användare som publicerar stora filer till servern.

Värdet som tilldelats den här egenskapen ska vara större eller lika med värdet som tilldelats egenskapen RequestLengthDiskThreshold .

Gäller för