Page.MaxPageStateFieldLength Page.MaxPageStateFieldLength Page.MaxPageStateFieldLength Page.MaxPageStateFieldLength Property


取得或設定頁面狀態欄位的最大長度。Gets or sets the maximum length for the page's state field.

 property int MaxPageStateFieldLength { int get(); void set(int value); };
public int MaxPageStateFieldLength { get; set; }
member this.MaxPageStateFieldLength : int with get, set
Public Property MaxPageStateFieldLength As Integer


頁面狀態欄位的最大長度 (以位元組為單位)。The maximum length, in bytes, for the page's state field. 預設值為 -1。The default is -1.


MaxPageStateFieldLength 屬性不等於 -1 或正數。The MaxPageStateFieldLength property is not equal to -1 or a positive number.

MaxPageStateFieldLength 屬性已在頁面初始化之後設定。The MaxPageStateFieldLength property was set after the page was initialized.


當屬性設定為正數時,傳送至用戶端瀏覽器的檢視狀態會分成多個隱藏欄位,而每個欄位的值會小於MaxPageStateFieldLength屬性中所指定的大小。 MaxPageStateFieldLengthWhen the MaxPageStateFieldLength property is set to a positive number, the view state sent to the client browser is broken into multiple hidden fields, and each field's value is less than the size specified in the MaxPageStateFieldLength property.

MaxPageStateFieldLength將屬性設定為負數(預設值),表示不應該將 [檢視狀態] 欄位分割成區塊。Setting the MaxPageStateFieldLength property to a negative number (the default) indicates that the view-state field should not be separated into chunks. 將設定MaxPageStateFieldLength為較小的數位,可能會導致效能不佳。Setting the MaxPageStateFieldLength to a small number may result in poor performance.

在 web.config 檔案的MaxPageStateFieldLength pages 元素中,設定屬性的值。Set the value of the MaxPageStateFieldLength property in the pages element of the Web.config file.