Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

XmlReaderSettings.XmlResolver Property

Sets the XmlResolver used to access external documents.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)
member XmlResolver : XmlResolver with set

Property Value

Type: System.Xml.XmlResolver
An XmlResolver used to access external documents. If set to a null reference (Nothing in Visual Basic), an XmlException is thrown when the XmlReader tries to access an external resource. The default is a new XmlUrlResolver with no credentials.

The XmlResolver is used to locate and open an XML instance document, or to locate and open any external resources referenced by the XML instance document. This can include entities, DTD, or schemas. The XmlResolver.Credentials property can be used to specify any credentials required for network authentication.

Security noteSecurity Note

Because the XmlResolver can contain sensitive information such as user credentials, you should be careful when caching XmlReaderSettings objects, or when passing the XmlReaderSettings object from one component to another.

An XmlSecureResolver can be used to access external documents. The XmlSecureResolver class helps to secure another implementation of XmlResolver by wrapping the XmlResolver object and restricting the resources that the underlying XmlResolver has access to. For more information, see NIB: How to: Use the XmlSecureResolver Class.

The ProcessInlineSchema and ProcessSchemaLocation validation flags of an XmlReaderSettings object are not set by default. When these flags are set, the XmlResolver of the XmlReaderSettings object is used to resolve schema locations encountered in the instance document in the XmlReader. If the XmlResolver object is a null reference (Nothing in Visual Basic), schema locations are not resolved even if the ProcessInlineSchema and ProcessSchemaLocation validation flags are set.

Schemas added during validation add new types and can change the validation outcome of the document being validated. As a result, external schemas should only be resolved from trusted sources.

The following example creates an XmlReader that uses an XmlSecureResolver with default credentials.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft. All rights reserved.