Forms authentication cookie - storing more than Identity
I'm going nuts trying to find a way to store a UserID within a FormsAuthentication cookie along side the users name.
I often store UserName and UserID in session objects when a user logs on. Of course these are lost once the session ends. Making the UserName persist between sessions is easy enough, but I can't for the life of me figure out how to customize this cookie to persist the UserID as well.
I've tried calling a sub from Application_AuthenticateRequest in global.asax that looks up the user (using user.Identity.Name) in my db, retriving the UserID and storing it in session, but I'm not having any luck with that either.
Any suggestions?