Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relationship between MembershipUser and IPrincipal object

I assume MembershipUser object and object implementing IPrincipal interface are “connected” in a sense that when certain information in one of the objects changes, the other object is also changed appropriately?

like image 575
SourceC Avatar asked May 10 '09 21:05

SourceC


Video Answer


1 Answers

Not sure whether or not I understand your question here but I believe your assumption is incorrect.

MembershipUser is used by System.Web.Security to authenticate a User via the MembershipProvider to you have set in you web config. When you call...

MembershipUser user = Membership.GetUser(username);

Your membership provider will query the datastore where you keep your user information (A Sql Database, Active Directory, etc..) and return back the Memberhsip data sotred for that username.

If you have defined another class in your application that implements the IPrincipal interface and you have instantiated an object of that type, that does not necessarily mean that your MembershipUser object and your custom object share data (unless of course you have assigned the reference programatically )

Maybe if you provided a code example it would help clarify

like image 94
matt_dev Avatar answered Sep 25 '22 01:09

matt_dev