Programming

Testing Your MVC Routes

Posted on

Everyone knows that is much easier to test a controller in MVC than it was to test “code behind” in Web Forms, but it is really easy to forget that routing rules are a rather important chunk of your logic. If the routing isn’t right, everything else fails. So you ought to be testing your […]

Programming

Adding Unity to Your Web API Project

Posted on

Adding Unity V3 to your ASP.NET Web API project is so easy it very nearly hurts. Despite this, I can foresee a couple of “duh” moments if you don’t spot a couple of minor details. To get started, you just open up the NuGet package manager, search online for Unity and select the appropriate version […]

Programming

Using CORS with ASP NET Web API

Posted on

If you are writing an ASP.NET Web API and you want to call it from a JavaScript (CoffeeScript, TypeScript) program on another domain, here are the steps you need to take to make it happen. I know that you are smart and you know what you are doing, so I’m not bulking out this article […]

Programming

Get Your MVC Models Right

Posted on

It seems like every time someone shows off their ASP.NET MVC application to me I have to make the same observation about their models, so I’ve decided to put the explanation online to save myself a great deal of repetition. As we all know, the Model in ASP.NET MVC is how information travels from the […]

Programming

ASP NET MVC Post/Redirect/Get Pattern

Posted on

This is just a quick article to hopefully dispel some common misunderstandings of the ASP.NET MVC Post/Redirect/Get Pattern. First up, a quick explanation of what the Post/Redirect/Get (or PRG) Pattern is for those who don’t know. The Problem With A POST The common problem is that if you submit a form, you end up on […]

Programming

JavaScript Includes and Rewritten URLs

Posted on

I recently answered a question on a forum about JavaScript includes in ASP.NET MVC and as the question came up again today, I thought I’d share the answer with the world. The issue that people are coming up against is that they have a script include with a relative path to their script file. Because […]