共用方式為


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

屬性值

最大請求大小(以千位元組計)。 預設大小為 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 財產所賦予的價值。

適用於