jackncoke
jackncoke

Reputation: 2020

Customizing ASP.net Membership 4.5

I am currently using the Default ASP.NET 4.5 membership that comes in place when you create a new solution. I have made some changes to it adding roles and so fourth but now that I want to continue to customize I was curious is it a "better practice" to customize the given membership (still researching how possible this is) or am I better off trying to build this from scratch? I am trying to teach my self so, I want to gain experience for what I could see if I was hired. Do business's use ASP.net Membership? My current project uses code first entity framework and LINQ. I feel like membership does a lot under the covers so to speak. Very little code behind for the actions it performs and it is kind of throwing me off now that I want to make changes.

Can anyone shed some light on this or maybe recommend some good reading?

Edit as per request

Simple things so far like when creating users I wanted to add some fields to request more information.

`  protected void RegisterUser_CreatedUser(object sender, EventArgs e)
        {
            FormsAuthentication.SetAuthCookie(RegisterUser.UserName, createPersistentCookie: false);

            string continueUrl = RegisterUser.ContinueDestinationPageUrl;
            if (!OpenAuth.IsLocalUrl(continueUrl))
            {
                continueUrl = "~/";
            }
            Response.Redirect(continueUrl);
        }` 

I don't see how the code-behind grabs the data in the form. Or how it really does anything embarrassingly enough. I have a good understanding of LINQ and Entity so I was thinking of modifying it with that and I am like how is this even possible to modify?

Upvotes: 1

Views: 2156

Answers (3)

Ravi Ram
Ravi Ram

Reputation: 24488

We have used MembershipProvider in several applications. Then we moved to Custom MembershipProvider which solved some domain specific requests from the client.

Our DBA was not happy with all the tables created in MSQL when we used the MembershipProvider

Now we are NOT using MembershipProvider and building most everything from scratch.

We do use some of the build in functions such as System.Web.Security.FormsAuthentication.SignOut(), etc.

Good Luck ..

Upvotes: 0

Win
Win

Reputation: 62260

The best practice will be just override the specific method instead of rewriting a brand new provider.

public class MyMembershipProvider : MembershipProvider {}

If you want to learn, I'll suggest to decompile the Provider dll and see what is under the hood. It is too large; I cannot post them here. Telerik JustDecompile.

Upvotes: 1

SOfanatic
SOfanatic

Reputation: 5573

From experiences some businesses use Custom MembershipProvider and Custom RoleProvider from .NET as their backbone to their membership provider. I think it would be helpful to follow a pattern similar to the this example: Custom MembershipProvider in .NET 4.0 and it should get you started.

Upvotes: 0

Related Questions