I’ve being doing a lot of work on Asp.Net MVC (now v2) over the past few months and, firstly, I have to say that it totally rocks. I will not go into any real detail about MVC here – this post is about the method System.Web.Mvc.HtmlHelper.AntiForgerytoken and that it highlights a bug in an internal class TokenPersister that you’re potentially going to get if you ever use spaces in your virtual directory names. Ironically, the class in question is marked with a comment that says it’s difficult to unit test because of the way it fakes Asp.Net requests – ironic that it should be such a class in which we find a bug! A better argument for unit-testing you’re unlikely to find. Detail – Reproduce that bug Using MVC it’s very easy to reproduce. I should start by declaring my system configuration: Windows 2008 R2 IIS 7.5 installed and configured Visual Studio 2008 with all service packs etc .Net 3.5 sp1 plus security patches VS2010 and .Net 4 are also on this machine –...
Replacing my old blog at http://www.lordzoltan.org. C#, rants and other brain vomit