重写自定义会员资格提供程序中的无参数 GetUser
目前,我正在使用以下代码来获取我的自定义 MembershipUser 和我的自定义membershipprovider:
FormsIdentity id = (FormsIdentity)User.Identity;
HtCustomUser user = (HtCustomUser) Membership.GetUser(id.Ticket.Name, true);
我想覆盖我的自定义 MembershipProvider 中的无参数 GetUser(),但无法弄清楚如何获取当前登录的用户,从我的提供者。目前,我已覆盖 GetUser(Username) 并使用我的数据存储中的数据创建自定义 MembershipUser。
Currently i'm using the following code to get my custom MembershipUser, with my custom membershipprovider:
FormsIdentity id = (FormsIdentity)User.Identity;
HtCustomUser user = (HtCustomUser) Membership.GetUser(id.Ticket.Name, true);
I would like to override the parameterless GetUser() in my custom MembershipProvider, but can't figure out how to get the currently logged in user, from my provider. Currently I have overridden the GetUser(Username) and creates the custom MembershipUser, with data from my data store.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与往常一样,在提出问题后,找到答案要容易得多:
允许我直接从提供者那里获取用户名,而不必使用客户端用户对象。
As always it is alot easier finding the answer, after a question has been asked:
Allows me to get the username, directly from the provider, without having to use the client User-object.