Submitted by: Srinath M S(srinath_ms@yahoo.com)

Tuesday Jul 10th 2018 by Srinath M S

Language: .NET, Expertise: Advanced - See an example of how ASP.NET's Web APIs support custom formatters.

ASP.NET's Web APIs support custom formatters. One of the best examples for a custom media formatter is a Vcalendar data format that can used in calendar software such as Outlook.

After you build the custom media formatter, all of you have to do is add it to the Web API configuration file. The WebApiConfig.cs is found in the App_Start folder.

In the register method, add the following line:

// CustomMediaTypeFormatter is the custom media type formatter created.
config.Formatters.Add(new CustomMediaTypeFormatter());
Mobile Site | Full Site