Working with Membership

DbEntry 4.2 doesn't include Membership dll by mistake, download Leafing.Membership.dll.zip and upzip it into %DbEntryPath% will be OK.
  • Create new web site in vs2010, add a web.config and change it as following:
<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="Leafing.Settings"
      type="Leafing.Util.Setting.NameValueSectionHandler, Leafing.Util" />
  </configSections>
 
  <Leafing.Settings>
    <add key="AutoCreateTable" value="true" />
    <add key="DataBase" value="@SQLite : @~Test.db" />
    <add key="DbProviderFactory"
value="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
  </Leafing.Settings>
  
  <appSettings/>
  <connectionStrings/>
  <system.web>
    <compilation debug="true"/>
 
    <membership defaultProvider="DbEntryMembershipProvider">
      <providers>
        <clear />
        <add name="DbEntryMembershipProvider" type="Leafing.Web.DbEntryMembershipProvider, Leafing.Web"/>
      </providers>
    </membership>
 
    <roleManager defaultProvider="DbEntryRole">
      <providers>
        <clear />
        <add name="DbEntryRole" type="Leafing.Web.DbEntryRoleProvider, Leafing.Web"/>
      </providers>
    </roleManager>
 
    <authentication mode="Forms">
      <forms name=".ADUAUTH" loginUrl="MyLogin.aspx" defaultUrl="Default.aspx" protection="All" />
    </authentication>
 
    <authorization>
      <deny users="?" />
      <allow users="*" />
    </authorization>
  </system.web>
</configuration>
  • Add the references of "Leafing.Util", "Leafing.Data" and "Leafing.Web"
  • Create a new page named "MyLogin.aspx"
  • Drag a CreateUserWizard control to MyLogin.aspx
  • Run this web site and create a user named "tom" and set the password as "123456"
  • Remove the CreateUserWizard control from MyLogin.aspx
  • Drag a Login control to MyLogin.aspx
  • Drag a LoginName control to Default.aspx
  • Run this web site and use "tom/123456" to login
  • Use SqlQuerier to check the "Test.db" in web folder, ensure the table already created, and the row of "tom" already created

Last edited Aug 27, 2014 at 7:47 AM by lifeng, version 11

Comments

No comments yet.