共用方式為


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 執行個體。

範例

下列程式碼會示範如何使用 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

適用於