帮助asp.net成员在mvc 3。

时间:2022-11-12 00:21:32

I need two things that the Membership Provider I'm sure is capable of doing. Firstly I need to initially set users that have just registered to have a IsApproved value of False.

我需要两件事,我相信会员提供者有能力做。首先,我需要先将刚刚注册的用户设置为isapproval值为False。

Obviously I also need an admin to be able to change that status to true.

很明显,我还需要一个管理员来更改这个状态为真。

Please help

请帮助

2 个解决方案

#1


2  

You don't need to create your custom provider. Just register the users manually using the MembershipProvider API.

您不需要创建自定义提供程序。只需使用MembershipProvider API手动注册用户。

public abstract MembershipUser MembershipProvider.CreateUser(
    string username,
    string password,
    string email,
    string passwordQuestion,
    string passwordAnswer,
    bool isApproved,
    Object providerUserKey,
    out MembershipCreateStatus status
)

MembershipUser has an IsApproved property. Your admins can use:

MembershipUser有一个IsApproved属性。您的管理员可以使用:

MembershipProvider.UpdateUser(MembershipUser);

to approve them.

批准他们。

#2


0  

I'm pretty sure it does not support that. You'd have to write your own custom provider to do that. Though, writing your own for SQL is not terribly complex and heavily documented in multiple places throughout the blogesphere.

我很确定它不支持这一点。您必须编写自己的自定义提供程序来实现这一点。但是,为SQL编写自己的SQL并不是非常复杂,并且在blogesphere的很多地方都有大量的文档。

#1


2  

You don't need to create your custom provider. Just register the users manually using the MembershipProvider API.

您不需要创建自定义提供程序。只需使用MembershipProvider API手动注册用户。

public abstract MembershipUser MembershipProvider.CreateUser(
    string username,
    string password,
    string email,
    string passwordQuestion,
    string passwordAnswer,
    bool isApproved,
    Object providerUserKey,
    out MembershipCreateStatus status
)

MembershipUser has an IsApproved property. Your admins can use:

MembershipUser有一个IsApproved属性。您的管理员可以使用:

MembershipProvider.UpdateUser(MembershipUser);

to approve them.

批准他们。

#2


0  

I'm pretty sure it does not support that. You'd have to write your own custom provider to do that. Though, writing your own for SQL is not terribly complex and heavily documented in multiple places throughout the blogesphere.

我很确定它不支持这一点。您必须编写自己的自定义提供程序来实现这一点。但是,为SQL编写自己的SQL并不是非常复杂,并且在blogesphere的很多地方都有大量的文档。