XmlSecureResolver.GetEntity Method (Uri, String, Type)

 
System_CAPS_noteNote

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
)

Parameters

absoluteUri
Type: System.Uri

The URI that is returned from ResolveUri.

role
Type: System.String

Currently not used.

ofObjectToReturn
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
XmlException

ofObjectToReturn is neither null nor a Stream type.

UriFormatException

The specified URI is not an absolute URI.

NullReferenceException

absoluteUri is null.

Exception

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
Show: