Lue englanniksi Muokkaa

Jaa


HttpResponseMessageProperty Class

Definition

Provides access to the HTTP response in order to access and respond to the additional information made available for requests over the HTTP protocol.

C#
public sealed class HttpResponseMessageProperty : System.ServiceModel.Channels.IMessageProperty
C#
public sealed class HttpResponseMessageProperty : System.ServiceModel.Channels.IMergeEnabledMessageProperty, System.ServiceModel.Channels.IMessageProperty
C#
public sealed class HttpResponseMessageProperty
Inheritance
HttpResponseMessageProperty
Implements
IMessageProperty System.ServiceModel.Channels.IMergeEnabledMessageProperty

Examples

This shows how to use create an instance of the HttpResponseProperty class and modify some of its members:

C#
HttpResponseMessageProperty responseProperty =
    new HttpResponseMessageProperty();
responseProperty.StatusCode = HttpStatusCode.OK;
responseProperty.Headers.Add(
                 HttpResponseHeader.ContentType,
                 "text/html; charset=UTF-8");

Remarks

This is a general-purpose class that gives you direct access to the HTTP response information, which could be used for encapsulation of HTTP-specific information. One use of this class is to support services implemented in accordance with the Representational State Transfer (REST) architecture.

This class enables you to support the following scenarios:

  • Controls whether an entity body is transmitted.

  • Allows HTTP header (key, value) pairs to be set for each response.

  • Varies the status code and status description used for each response.

This class can be used by HttpTransportBindingElement and related classes.

Constructors

HttpResponseMessageProperty()

Initializes a new instance of the HttpResponseMessageProperty class.

Properties

Headers

Gets the HTTP headers from the HTTP response.

HttpResponseMessage
Name

Gets the name of the message property associated with the HttpResponseMessageProperty class.

StatusCode

Gets or sets the status code of the current HTTP response to which this property is attached.

StatusDescription

Gets or sets the description of the status code of the current HTTP response to which this property is attached.

SuppressEntityBody

Gets or sets a value that indicates whether the body of the message is ignored and an empty message is sent.

SuppressPreamble

Gets or sets whether the message preamble is suppressed.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

Applies to

Tuote Versiot
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0