Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

MediaTypeFormatterExtensions.AddRequestHeaderMapping Method (MediaTypeFormatter, String, String, StringComparison, Boolean, String)

Updates the given set of formatter of MediaTypeMapping elements so that it associates the mediaType with a specific HTTP request header field with a specific value.

Namespace:  System.Net.Http.Formatting
Assembly:  System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)
static member AddRequestHeaderMapping : 
        formatter:MediaTypeFormatter * 
        headerName:string * 
        headerValue:string * 
        valueComparison:StringComparison * 
        isValueSubstring:bool * 
        mediaType:string -> unit 

Parameters

formatter
Type: System.Net.Http.Formatting.MediaTypeFormatter
The MediaTypeFormatter to receive the new MediaRangeMapping item.
headerName
Type: System.String
Name of the header to match.
headerValue
Type: System.String
The header value to match.
valueComparison
Type: System.StringComparison
The StringComparison to use when matching headerValue.
isValueSubstring
Type: System.Boolean
if set to true then headerValue is considered a match if it matches a substring of the actual header value.
mediaType
Type: System.String
The media type to associate with a Header() entry with a name matching headerName and a value matching headerValue.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type MediaTypeFormatter. When you use instance method syntax to call this method, omit the first parameter. For more information, see http://msdn.microsoft.com/en-us/library/bb384936(v=vs.108).aspx or http://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).aspx.

RequestHeaderMapping checks header fields associated with Headers() for a match. It does not check header fields associated with Headers() or Headers() instances.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.