Sending Email From C# Via Hotmail/Outlook/Windows Live

I recently found myself wanting to send an email from an ASP.NET web application. I didn’t want to go to all the hassle of setting up an SMTP server just to test my code, so decided to do it through an outlook.com email account. Here’s how:

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#: