HttpRequestMessageProperty Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the HttpRequestMessageProperty class.
public:
HttpRequestMessageProperty();
public HttpRequestMessageProperty ();
Public Sub New ()
Examples
The following code shows how to instantiate this class from a message without explicitly calling the constructor.
public void ProcessMessage(Message input)
{
try
{
Console.WriteLine("ProcessMessage: Message received: " + input.GetBody<string>());
HttpRequestMessageProperty reqProp = (HttpRequestMessageProperty)input.Properties[HttpRequestMessageProperty.Name];
string customString = reqProp.Headers.Get("CustomHeader");
string userAgent = reqProp.Headers[HttpRequestHeader.UserAgent];
Console.WriteLine();
Console.WriteLine("ProcessMessage: Got custom header: {0}, User-Agent: {1}", customString, userAgent);
}
catch (Exception e)
{
Console.WriteLine("ProcessMessage: got exception: " + e.ToString());
}
}
Public Sub ProcessMessage(ByVal input As Message) Implements IUntypedService.ProcessMessage
Try
Console.WriteLine("ProcessMessage: Message received: " & input.GetBody(Of String)())
Dim reqProp = CType(input.Properties(HttpRequestMessageProperty.Name), HttpRequestMessageProperty)
Dim customString = reqProp.Headers.Get("CustomHeader")
Dim userAgent = reqProp.Headers(HttpRequestHeader.UserAgent)
Console.WriteLine()
Console.WriteLine("ProcessMessage: Got custom header: {0}, User-Agent: {1}", customString, userAgent)
Catch e As Exception
Console.WriteLine("ProcessMessage: got exception: " & e.ToString())
End Try
End Sub
Remarks
This constructor initializes the object as follows:
Method =
POST
.QueryString is set to the empty string.
SuppressEntityBody =
false
.
Applies to
Συνεργαστείτε μαζί μας στο GitHub
Μπορείτε να βρείτε την πηγή για αυτό το περιεχόμενο στο GitHub, όπου μπορείτε επίσης να δημιουργήσετε και να εξετάσετε ζητήματα και αιτήματα έλξης. Για περισσότερες πληροφορίες, ανατρέξτε στον οδηγό συνεργατών.