MembershipUser 和 IPrincipal 对象之间的关系
我假设 MembershipUser 对象和实现 IPrincipal 接口的对象在某种意义上是“连接”的,即当其中一个对象中的某些信息发生更改时,另一个对象也会相应地更改?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定我是否理解你的问题,但我相信你的假设是不正确的。
System.Web.Security 使用 MembershipUser 通过您在 Web 配置中设置的 MembershipProvider 对用户进行身份验证。 当您致电...时,
您的会员资格提供商将查询您保存用户信息的数据存储(Sql 数据库、Active Directory 等),并返回为该用户名存储的 Memberhsip 数据。
如果您在应用程序中定义了另一个实现 IPrincipal 接口的类,并且已实例化该类型的对象,则这并不一定意味着您的 MembershipUser 对象和自定义对象共享数据(当然,除非您以编程方式分配了引用)
也许如果您提供一个代码示例,它会有助于澄清
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...
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