Page.MaxPageStateFieldLength 属性

定义

获取或设置页状态字段的最大长度。Gets or sets the maximum length for the page's state field.

public:
 property int MaxPageStateFieldLength { int get(); void set(int value); };
[System.ComponentModel.Browsable(false)]
public int MaxPageStateFieldLength { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.MaxPageStateFieldLength : int with get, set
Public Property MaxPageStateFieldLength As Integer

属性值

Int32

页的状态字段的最大长度(以字节为单位)。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.

MaxPageStateFieldLength在 Web.config 文件的pages 元素中设置属性的值。Set the value of the MaxPageStateFieldLength property in the pages element of the Web.config file.

适用于