This is just me documenting a particularly weird behaviour of ASP.NET MVC. Usually, it doesn’t matter, but if you used your own controller factory, like with MvcContrib, it’s a pain to diagnose. Basically, if you re-use a controller, the ModelBindingContext’s values are cached. This is, to say the least, freaky, especially since you can see that the url has changed. So, you fire up one page, move to another id and get back the first page. In short, register controllers as transient explicitly. If you’re wondering how I found this out, consider that AllTypes in Castle Windsor registers services as singletons by default.
Don’t register controllers as singletons in your container
Technorati Tags: ASP.NET MVC,Castle Windsor,MvcContrib