Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
How can i use asp.net membership provider to store user form details in database.
after storing i have to authenticate users for login in different roles.

and also i have to implement on tier architecture

i have search on google here is link which show to download
i do not know what is this

http://efmembership.codeplex.com/[^]
Posted
Updated 20-Aug-13 4:14am
v3
Comments
Naman Kumar Sinha 20-Aug-13 8:51am    
Can you be more specific as to what exactly you want? Is it a website or web app? You want to implement Membership authentication in Entity Framework site/app ! What do you mean by tier architecture here, are you creating MVC app or is it just a design consideration? As of now since nothing is clear I'll suggest keeping the authentication and business logic separate.
saurabh bhatia1 20-Aug-13 9:22am    
hi sir,
thanks for your reply
it is application
and also it is not mvc
using class library i will make BAL DAL and UI

1 solution

Below article may be helped to understand the ASP.NET default Membership and Role Provider mechanism. Then you just need to replace that membership provider with Entity framework membership provider details as shown bottom of this answer.

ASP.NET default Membership and Role Provider :

ASP.NET Membership and Role Provider[^]

EF membership provider

http://omid.mafakher.name/entity-framework-membership-provider-2[^]

http://efmembership.codeplex.com/[^]

Hence you're using Asp.Net database (aspnet_regsql). you have to replace it with this code:

Open and edit your web.config or app.config. In the system.web section:

C#
<membership defaultprovider="OmidIDMembershipProvider">
        <providers>
            <clear />
            <add name="OmidIDMembershipProvider">
                 type="OmidID.Web.Security.EFMembershipProvider`2[
                           [OmidID.Web.Security.Default.AspNet.AspUser,
                                OmidID.Web.Security.EFMembershipProvider],
                           [System.Guid]], OmidID.Web.Security.EFMembershipProvider"
                 connectionStringName="ApplicationServices" tablePrefix="aspnet_"
                 enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
                 maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
                 applicationName="/" />
        </add></providers>
    </membership>

    <rolemanager enabled="true" defaultprovider="OmidIDRoleProvider">
        <providers>
            <clear />
            <add name="OmidIDRoleProvider">
              type="OmidID.Web.Security.EFRoleProvider`3[
                          [OmidID.Web.Security.Default.AspNet.AspRole,
                               OmidID.Web.Security.EFMembershipProvider],
                          [OmidID.Web.Security.Default.AspNet.AspUserInRole,
                               OmidID.Web.Security.EFMembershipProvider],
                          [System.Guid]], OmidID.Web.Security.EFMembershipProvider"
              connectionStringName="ApplicationServices" tablePrefix="aspnet_"
              applicationName="/" />
        </add></providers>
    </rolemanager>


I hope this will help to you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900