XmlSecureResolver.GetEntity Method (Uri, String, Type)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Maps a URI to an object that contains the actual resource. This method temporarily sets the System.Security.PermissionSet created in the constructor by calling PermissionSet.PermitOnly before calling GetEntity on the underlying XmlResolver to open the resource.

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

public override object GetEntity(
	Uri absoluteUri,
	string role,
	Type ofObjectToReturn


Type: System.Uri

The URI that is returned from ResolveUri.

Type: System.String

Currently not used.

Type: System.Type

The type of object to return. The current version only returns Stream objects.

Return Value

Type: System.Object

The stream returned by calling GetEntity on the underlying XmlResolver. If a type other than Stream is specified, the method returns null.

Exception Condition

ofObjectToReturn is neither null nor a Stream type.


The specified URI is not an absolute URI.


absoluteUri is null.


There is a runtime error (for example, an interrupted server connection).

System_CAPS_security Security Note

Your application can mitigate memory denial of service threats to the GetEntity method by implementing an IStream that limits the number of bytes read. This helps guard against situations where malicious code attempts to pass an infinite stream of bytes to the GetEntity method.

.NET Framework
Available since 1.1
Return to top