Udostępnij za pośrednictwem


HttpProductInfoHeaderValue Class

Definition

Represents product information used in the User-Agent HTTP header on an HTTP request.

public ref class HttpProductInfoHeaderValue sealed : IStringable
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.Headers.IHttpProductInfoHeaderValueFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class HttpProductInfoHeaderValue final : IStringable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.Headers.IHttpProductInfoHeaderValueFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class HttpProductInfoHeaderValue final : IStringable
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.Headers.IHttpProductInfoHeaderValueFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class HttpProductInfoHeaderValue : IStringable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.Headers.IHttpProductInfoHeaderValueFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class HttpProductInfoHeaderValue : IStringable
function HttpProductInfoHeaderValue(productName, productVersion)
Public NotInheritable Class HttpProductInfoHeaderValue
Implements IStringable
Inheritance
Object Platform::Object IInspectable HttpProductInfoHeaderValue
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

The HttpProductInfoHeaderValue class represents product information used in the User-Agent HTTP header on an HTTP request.

The User-Agent header contains information about the user agent originating the request. The User-Agent header can contain multiple product tokens, each followed by optional comments which together identify the user agent and any sub-products. By convention, the product identifiers are listed in decreasing order of their significance for identifying the user agent software. Each product identifier consists of a name and optional version.

Each instance of the HttpProductInfoHeaderValue contains either a value for the Product or Comment property, but not both simultaneously.

The UserAgent property on the HttpRequestHeaderCollection returns an HttpProductInfoHeaderValueCollection that contains HttpProductInfoHeaderValue objects.

Constructors

HttpProductInfoHeaderValue(String, String)

Initializes a new instance of the HttpProductInfoHeaderValue class with a product name and version.

HttpProductInfoHeaderValue(String)

Initializes a new instance of the HttpProductInfoHeaderValue class with a product comment.

Properties

Comment

Gets the product comment from the HttpProductInfoHeaderValue used in the User-Agent HTTP header.

Product

Gets the product from the HttpProductInfoHeaderValue used in the User-Agent HTTP header.

Methods

Parse(String)

Converts a string to an HttpProductInfoHeaderValue instance.

ToString()

Returns a string that represents the current HttpProductInfoHeaderValue object.

TryParse(String, HttpProductInfoHeaderValue)

Determines whether a string is valid HttpProductInfoHeaderValue information.

Applies to

See also