ASP.NET MVC


How to add OpenID authentication to your ASP.NET MVC 3 site using Janrain Engage

Well, I finally took the time to implement OpenID/Social network log-in functionality to Would Be Better and although I had anticipated a much more troublesome process, it wasn’t entirely clear how I had to proceed on several of the steps either. I’d like to share my experiences with you.   W ...

Dealing with javascript or JSON results after an AJAX call with Ajax.ActionLink, unobtrusive AJAX and MVC 3

I’ve recently updated an MVC 3 project to use unobtrusive ajax. If you create a new ASP.NET MVC 3 project unobtrusive ajax will be enabled by default, but this was a project I had once migrated from MVC 2. Instead of physically adding the unobtrusive ajax JavaScript file to my solution I got it from ...

Mocking a ControllerContext with authenticated user with Moq for ASP.NET MVC (3)

Whenever you are writing unit tests or BDD-style specs for your ASP.NET MVC controllers (you are, right?) there will come a moment when you actually need to simulate that a user is authenticated to your site. Even if you’re familiar with mocking, letting the controller think someone has logged in t ...

Using dynamic to unit test an Action Method that returns JsonResult with MVC 3 and C# 4

We’ve all been there, haven’t we? We have an action method that we call through Ajax.ActionLink, Ajax.BeginForm or even with jQuery.ajax, and returning a JsonResult is what makes the most sense. But whatever you pass to a  JsonResult only gets exposed through the JsonResult.Data property which, ...

Simple Time Picker model binder for ASP.NET MVC 3, and how to save it to SQL CE 4 using EF 4.1

There’s plenty of DatePickers out there, like, for instance, the ubiquitous jQuery DatePicker, but how about Time pickers? Well if you’re looking for a fancy, flashy, drop-dead-gorgeous Time picker control… this post isn’t for you. What this post will teach you, dear reader, is how to simply and ...