I'm currently generating a WindowsIdentity object in my MVC application and I'd ideally would like to cache it so I won't be hitting the AD on every request; The problem is that I often get the exception: "Safe Handle has been closed"
I've read somewhere that this error pops up because after the request ends, IIS closes the handle of the thread principal (in this case a windows principal that I instantiate using the cached windows identity).
Cutting to the point, should I be caching this object? is caching the token a better idea? Or should I give up on the idea of caching any of those?
Thanks in advance!