HttpRuntimeSection.MaxRequestLength 屬性

定義

取得或設定最大要求大小。

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

屬性值

最大要求大小 (以 KB 為單位)。 預設大小為 4096 KB (4 MB)。

屬性

例外狀況

範例

下列範例示範如何取得目前的 MaxRequestLength 屬性值。

// 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

備註

屬性 MaxRequestLength 會指定輸入資料流程緩衝閾值的限制。 例如,此限制可用來防止由將大型檔案張貼至伺服器的使用者所造成的拒絕服務攻擊。

指派給這個屬性的值應該大於或等於指派給 RequestLengthDiskThreshold 屬性的值。

適用於