共用方式為


HttpRuntimeSection.MaxQueryStringLength 屬性

定義

取得或設定 HTTP 請求中查詢字串的最大可能長度(字元數)。

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

屬性值

查詢字串的最大長度,以字元數為單位。 預設是2048。

屬性

備註

該財產的 MaxQueryStringLength 價值可以是任何整數、零或更大。 如果查詢字串的長度超過大小限制,ASP.NET 會回傳 HTTP 400 (錯誤請求)狀態碼。

備註

極小的數值可能會讓網站無法使用。

你可以在設定檔中設定 maxQueryStringLength 元素屬性 httpRuntime 來設定這個值。 更多資訊請參閱 httpRuntime Element(ASP.NET 設定結構)。

備註

還有一個 IIS 設定可以控制查詢字串長度。 請參閱 maxQueryStringRequest Limits <>中的 requestLimit 屬性。

適用於