HttpRuntimeSection.MaxRequestLength HttpRuntimeSection.MaxRequestLength HttpRuntimeSection.MaxRequestLength HttpRuntimeSection.MaxRequestLength Property

定義

取得或設定最大要求大小。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; }
member this.MaxRequestLength : int with get, set
Public Property MaxRequestLength As Integer

屬性值

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

例外狀況

範例

下列範例示範如何取得目前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.

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

適用於