Storing User Information (IIdentity or Custom Object)

When the user logs into the system, I need to go grab some information (Full Name, Email, EmployeeID, Etc.) and store it in a global place for the application to get at. I can think of two options off the back. I could create my own custom principal / identity classes and store the information in here, or I could go ahead and create a UserProfile object and make it a singleton and store it there. Which option do you guys think sounds more appropriate.

Thanks!


Answer this question

Storing User Information (IIdentity or Custom Object)

  • James Minns

    Thanks, I'll take a look. That brings another good point. If I did go the custom identity route, if I was using web services, would this break or would the principal carry over

    Thanks

  • Tacho

    Yes. You would not get the same identity object. There may be some tricks for passing it or building a new one, but you are crossing application bounderies. Perhaps someone else on the forum has an idea for that case.

  • wujek_bak

    In the past I have used the custom identity. As long as you are staying in the same process it works well. I especially like that it is already defined a standard for the framework and it carries across layers without having to pass the information in all of the method calls.

    You also may want to look at the Security Application Block in the Enterprise library. I haven't looked at it yet, but if it uses the same patterns as the old Authorization and Profile Application Block, at the least you can get some good examples.

    Tim Murphy



  • Storing User Information (IIdentity or Custom Object)