XmlReaderSettings.MaxCharactersFromEntities Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value indicating the maximum allowable number of characters in a document that result from expanding entities.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

Syntax

'Declaration
Public Property MaxCharactersFromEntities As Long
public long MaxCharactersFromEntities { get; set; }

Property Value

Type: System.Int64
The maximum allowable number of characters from expanded entities. The default is 0.

Remarks

A zero (0) value means no limits on the number of characters that result from expanding entities. A non-zero value specifies the maximum number of characters that can result from expanding entities.

If the reader attempts to read a document that contains entities such that the expanded size will exceed this property, an XmlException will be thrown.

This property allows you to mitigate denial of service attacks where the attacker submits XML documents that attempt to exceed memory limits via expanding entities. By limiting the characters that result from expanded entities, you can detect the attack and recover reliably.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.