Create Users in ASP.net website administration tool
I am exploring the Membership class of the ASP.net and configuring the roles and users.
Is it a must to set security question in ASP.net administration tool? Because I don't think my system开发者_如何学Go needs the security question.
If I have quite a number of users, how can I import the list of users? I don't want to create users in the administation tool one by one.
You can change the requirements in the web.config file.
<membership defaultProvider="myProvider" userIsOnlineTimeWindow="20">
<providers>
<add
name="myProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""/>
</providers>
</membership>
requiresQuestionAndAnswer="false" is the important bit for your example.
The membership provider API enables you to create users in code. eg Membership.CreateUser You easily use this to write a small utility to import your users from a list.
you can code a method which loops the users that you want to import and import them one by one with http://msdn.microsoft.com/en-us/library/t8yy6w3h.aspx
you will get a membershipuser object from that method which you can configure further
精彩评论