Make WebAPI Return JSON to an AJAX Request

If you make an AJAX call to a WebAPI service using an XmlHttpRequest object, you’ll notice that the data returned to you is formatted as XML. This is because the “Accept” header in a typical XmlHttpRequest call looks something like this:

Introduction to Design Time Templating in C#

While a good developer will always do their best to write DRY code, cases do arise when repetition is inevitable. Mapping one object type to another provides a good example of this. While reflection can be used to compare types against one another, in high-volume contexts the performance loss that reflection incurs may be too significant.

Get the Length of a Video in C#

There are two main ways to get the length of a video file in C#:

Encrypting a web.config file

1. Publish your web application to IIS