Skip to content

Store user profiles and roles in MongoDB storage. And allow easy access to use thems from MemberShipProvider, ProfileProvider, RoleProvider in ASP.NET

License

anktsrkr/MongoMembership

 
 

Repository files navigation

MongoMembership

Contain ASP.NET providers for working with Membership, Role, Profile via MongoDB.

Nuget

https://nuget.org/packages/MongoMembership

Configuration

MongoMembership should been added and configured in your Web.config file

    <configuration>
	<connectionStrings>
	    <add name="MONGOLAB_URI" connectionString="mongodb://localhost/MongoLab"/>
	    <add name="MongoUri" connectionString="mongodb://localhost/TestMongoMembershipProvider"/>
	</connectionStrings>
        <system.web>
            <membership defaultProvider="MongoMembershipProvider">
                <providers>
                     <clear/>
                     <add name="MongoMembershipProvider"
                          type="MongoMembership.Providers.MongoMembershipProvider"
                          connectionStringKeys="MongoUri"
                          enablePasswordRetrieval="false"
                          enablePasswordReset="true"
                          requiresQuestionAndAnswer="false"
                          requiresUniqueEmail="false"
                          maxInvalidPasswordAttempts="5"
                          minRequiredPasswordLength="6"
                          minRequiredNonalphanumericCharacters="0"
                          passwordAttemptWindow="10"
                          applicationName="/" />
                </providers>
            </membership>

            <profile defaultProvider="MongoProfileProvider">
                <providers>
                    <clear/>
                    <add name="MongoProfileProvider"
                         type="MongoMembership.Providers.MongoProfileProvider"
                         connectionStringKeys="MongoUri"
                         applicationName="/" />
                </providers>
            </profile>

            <roleManager defaultProvider="MongoRoleProvider">
                <providers>
                    <clear/>
                    <add name="MongoRoleProvider"
                         type="MongoMembership.Providers.MongoRoleProvider"
                         connectionStringKeys="MongoUri"
                         applicationName="/" />
                </providers>
            </roleManager>
        </system.web>
    </configuration>

Please notice

Each provider have new attribute connectionStringKeys which could contain coma separated keys(links) to the keys in appSettings section. Order of keys is important. Each key in appSettings should be connection string to MongoDB or should absent in config. If no connection string is configured then default: "mongodb://localhost/MongoMembership" will be used.

License

MongoMembership is free software distributed under the terms of MIT License (see LICENSE.txt) these terms don�t apply to other 3rd party tools, utilities or code which may be used to develop this application.

P.S.

Do not forget to give your feedback about this project.

About

Store user profiles and roles in MongoDB storage. And allow easy access to use thems from MemberShipProvider, ProfileProvider, RoleProvider in ASP.NET

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.8%
  • Other 0.2%