In my ASP.NET mvc app, I wrote my own custom IIdentity which I swap with the default FORMS identity. I do this using Application_PostAuthenticateRequest in Global.asax. This works for the most part as it gives me a more meaningful identity prior to invoking actions on my MVC controller. Unforunately, things fall apart after the controller call. Something in the ASP.NET framework is bound and determined to serialize my identity and blows up during this process. I even made my custom identity serializable but it still blows up. Note, I can serialize / deserialize this class in a unit test using the binary formatter.
Here is the exception:
[SerializationException: Type is not resolved for member 'MvcTest.Models.SiteUser,MvcTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.]
Microsoft.VisualStudio.WebHost.Server.GetProcessToken() +0
Microsoft.VisualStudio.WebHost.Host.GetProcess ...
Go to the complete details ...