会员提供者用户 ID
问候, 我为我的 asp.net mvc 应用程序编写了一个自定义 MembershipProvider。我按如下方式获取用户:
public override MembershipUser GetUser(string username, bool userIsOnline)
{
using (CPersistanceManager pm = new CPersistanceManager())
{
pm.EnsureConnectionOpen();
MembershipUser membershipUser = null;
COperator oper = pm.OperatorRepository.Get(username);
membershipUser = new MembershipUser(ApplicationName,
oper.Username,
oper.ROWGUID,
oper.Email,
string.Empty,
string.Empty,
oper.IsActive,
false,
DateTime.Today,
DateTime.Today,
DateTime.Today,
DateTime.Today,
DateTime.Today
);
return membershipUser;
}
}
然后如何在任何控制器中检索记录的用户 ID(rowguid)?
Greetings,
I wrote a custom MembershipProvider for my asp.net mvc application. I get the user as follows:
public override MembershipUser GetUser(string username, bool userIsOnline)
{
using (CPersistanceManager pm = new CPersistanceManager())
{
pm.EnsureConnectionOpen();
MembershipUser membershipUser = null;
COperator oper = pm.OperatorRepository.Get(username);
membershipUser = new MembershipUser(ApplicationName,
oper.Username,
oper.ROWGUID,
oper.Email,
string.Empty,
string.Empty,
oper.IsActive,
false,
DateTime.Today,
DateTime.Today,
DateTime.Today,
DateTime.Today,
DateTime.Today
);
return membershipUser;
}
}
how can I then retrieve logged user id (rowguid) in any controller?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以执行如下操作:
现在,您可以对
user
对象执行任何您想要的操作You can do something like the following:
Now, you can do whatever you want with the
user
object