ZoneIdentifier Class

Represents the zone information stored in a Zone.Identifier alternate data stream.

public sealed class ZoneIdentifier

Remarks

The values are the ones the stream records, not the zone Windows assigns to the file. Use MarkOfTheWeb.GetFileZone or MarkOfTheWeb.IsUntrusted to make a security decision.

Properties

NameDescription
HostUrlGets the URL the file was downloaded from, or null when the stream does not record one.
ReferrerUrlGets the URL of the page that linked to the file, or null when the stream does not record one.
ZoneGets the zone recorded by the ZoneId entry, or UrlZone.Invalid when there is no usable entry.

Gets the URL the file was downloaded from, or null when the stream does not record one.

public string? HostUrl { get; }

Property value

string?

Gets the URL of the page that linked to the file, or null when the stream does not record one.

public string? ReferrerUrl { get; }

Property value

string?

Gets the zone recorded by the ZoneId entry, or UrlZone.Invalid when there is no usable entry.

public UrlZone Zone { get; }

Property value

UrlZone

Remarks

The value can be a custom zone, numbered 1000 and above, that has no named UrlZone member.

Methods

NameDescription
Parse(string)Parses the content of a Zone.Identifier alternate data stream.

Parse(string)

ZoneIdentifier.cs

Parses the content of a Zone.Identifier alternate data stream.

public static ZoneIdentifier Parse(string content)

Parameters

content string
The content of the stream, as returned by MarkOfTheWeb.GetFileZoneContent.

Returns

ZoneIdentifier The zone information found in the [ZoneTransfer] section.

Remarks

Section and key names are case-insensitive, and whitespace around keys and values is ignored. An entry that is repeated with different values is ambiguous, so it is reported as absent.