I have Forms authentication and I need a custom object to be stored in HttpContext.Current.User and in Thread.CurrentPrincipal.
To get this, I listen to PostAuthenticateRequest event, then read from the DB all the user data I need to be stored in HttpContext.Current.User and in Thread.CurrentPrincipal, then I instantiate custom IPrincipal and IIdentity objects and assign them to the above locations.
The problem is that for some reason PostAuthenticateRequest fires several times for a single request.. This causes unnecessary DB roundtrips that hurt performance..
How should I address this? (ASP.NET MVC 2)
Thanks.