XmlSecureResolver.GetEntity(Uri, String, Type) Method

Definition

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

public:
 override System::Object ^ GetEntity(Uri ^ absoluteUri, System::String ^ role, Type ^ ofObjectToReturn);
public override object? GetEntity (Uri absoluteUri, string? role, Type? ofObjectToReturn);
public override object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn);
override this.GetEntity : Uri * string * Type -> obj
Public Overrides Function GetEntity (absoluteUri As Uri, role As String, ofObjectToReturn As Type) As Object

Parameters

absoluteUri
Uri

The URI that is returned from ResolveUri(Uri, String).

role
String

Currently not used.

ofObjectToReturn
Type

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

Returns

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

Exceptions

ofObjectToReturn is neither null nor a Stream type.

-or-

.NET 7 and later versions: In all cases.

The specified URI is not an absolute URI.

absoluteUri is null.

There is a run-time error (for example, an interrupted server connection).

Remarks

Important

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.

Applies to