HttpRuntimeSection.MaxRequestLength 屬性

定義

取得或設定最大要求大小。Gets or sets the maximum request size.

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

屬性值

Int32

最大要求大小 (以 KB 為單位)。The maximum request size in kilobytes. 預設大小為 4096 KB (4 MB)。The default size is 4096 KB (4 MB).

屬性

例外狀況

選取的值小於 RequestLengthDiskThresholdThe selected value is less than RequestLengthDiskThreshold.

範例

下列範例顯示如何取得目前的 MaxRequestLength 屬性值。The following example shows how to obtain the current MaxRequestLength property value.

// 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屬性會指定輸入資料流程的緩衝閾值限制。The MaxRequestLength property specifies the limit for the buffering threshold of the input stream. 例如,這項限制可用來防止將大型檔案張貼到伺服器的使用者所造成的阻絕服務攻擊。For example, this limit can be used to prevent denial of service attacks that are caused by users who post large files to the server.

指派給這個屬性的值應該大於或等於指派給屬性的值 RequestLengthDiskThresholdThe value assigned to this property should be greater or equal to value assigned to the RequestLengthDiskThreshold property.

適用於