WebOperationContext.OutgoingRequest 属性

定义

获取正在发送的请求的 Web 请求上下文。

public:
 property System::ServiceModel::Web::OutgoingWebRequestContext ^ OutgoingRequest { System::ServiceModel::Web::OutgoingWebRequestContext ^ get(); };
public System.ServiceModel.Web.OutgoingWebRequestContext OutgoingRequest { get; }
member this.OutgoingRequest : System.ServiceModel.Web.OutgoingWebRequestContext
Public ReadOnly Property OutgoingRequest As OutgoingWebRequestContext

属性值

OutgoingWebRequestContext

一个 OutgoingWebRequestContext 实例。

示例

下面的代码演示如何设置方法和内容类型,以及如何向传出请求添加标头。

WebOperationContext.Current.OutgoingRequest.Headers.Add("Slug", "title");
WebOperationContext.Current.OutgoingRequest.Method = "GET";
WebOperationContext.Current.OutgoingRequest.ContentType = "application/octet-stream";
WebOperationContext.Current.OutgoingRequest.Headers.Add("Slug", "title")
WebOperationContext.Current.OutgoingRequest.Method = "GET"
WebOperationContext.Current.OutgoingRequest.ContentType = "application/octet-stream"

适用于