How To Setup Initial User
According to Chris Blankenship's
Starter accounts for Alternative Membership Provider,
I found there are cases when it is required to setup some initial (starter) user with ASP.NET XmlProviders.
Thus, I have added some additional attributes’ support to XmlMembershipProvider: initialRole, initialUser and initialPassword.
So, if you want when using ASP.NET XmlProviders to setup some initial user to be able to login first time and then later as logged user to do any changes required, you can add it by using those additional attributes.
For example, let’s say you want to add user - admin, password – admin, in role Administrators.
Here is how the XmlMembershipProvider config element will look like in your web.config file:
<membership defaultProvider="XmlMembershipProvider">
<providers>
<clear/>
<add applicationName="Test" name="XmlMembershipProvider" type="Artem.Web.Security.XmlMembershipProvider"
minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0"
requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed"
initialUser="admin" initialPassword="admin" initialRole="Administrators"/>
</providers>
</membership>
This will create a user admin with password admin in role Administrators first time you use XmlMembershipProvider and if there is no Users.config file existing.
Happy coding ...Any smart ideas and comments are welcome.
Please do not hesitate to question meSee more about me and my works under
ArtemBG |
WebUtil.net