MediaTypeFormatterExtensions.AddUriPathExtensionMapping Method (MediaTypeFormatter, String, String)

Updates the given formatter's set of MediaTypeMapping elements so that it associates the mediaType with Uris ending with the given uriPathExtension.

Namespace:  System.Net.Http.Formatting
Assembly:  System.Web.Http (in System.Web.Http.dll)


<ExtensionAttribute> _
Public Shared Sub AddUriPathExtensionMapping ( _
    formatter As MediaTypeFormatter, _
    uriPathExtension As String, _
    mediaType As String _
Dim formatter As MediaTypeFormatter
Dim uriPathExtension As String
Dim mediaType As String

formatter.AddUriPathExtensionMapping(uriPathExtension, _
public static void AddUriPathExtensionMapping(
    this MediaTypeFormatter formatter,
    string uriPathExtension,
    string mediaType
static void AddUriPathExtensionMapping(
    MediaTypeFormatter^ formatter, 
    String^ uriPathExtension, 
    String^ mediaType
static member AddUriPathExtensionMapping : 
        formatter:MediaTypeFormatter * 
        uriPathExtension:string * 
        mediaType:string -> unit 
public static function AddUriPathExtensionMapping(
    formatter : MediaTypeFormatter, 
    uriPathExtension : String, 
    mediaType : String


  • mediaType
    Type: System.String
    The string media type to associate with Uris ending with uriPathExtension.

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 or

See Also


MediaTypeFormatterExtensions Class

AddUriPathExtensionMapping Overload

System.Net.Http.Formatting Namespace