Storing User Information (IIdentity or Custom Object) RRS feed

  • Question

  • 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.

    Tuesday, March 28, 2006 3:42 PM

All replies

  • 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

    Tuesday, March 28, 2006 4:05 PM
  • 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?

    Tuesday, March 28, 2006 4:22 PM
  • 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.
    Tuesday, March 28, 2006 5:22 PM