WebOperationContext.IncomingRequest 属性

定义

获取正在接收的请求的 Web 请求上下文。

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

属性值

IncomingWebRequestContext

一个 IncomingWebRequestContext 实例。

示例

下面的代码示例演示如何使用 IncomingRequest 属性访问传入 HTTP 请求中的标头。

WebOperationContext current = WebOperationContext.Current;
WebHeaderCollection headers = current.IncomingRequest.Headers;

foreach (string name in headers)
{
    Console.WriteLine(name + " " + headers.Get(name));
}
Dim current As WebOperationContext = WebOperationContext.Current
Dim headers As WebHeaderCollection = current.IncomingRequest.Headers

For Each name As String In headers
    Console.WriteLine(name + " " + headers.Get(name))
Next

适用于