0

I have to edit the Login/Registration that ASP provides to include a custom dropdown ("BranchID") menu that saves to the database so each user has its own Branch. I am using ASP Membership system, and of course it saves to the ASPNETMDF database it creates. Googling has net me some results but I am quite confused. I know there are "User Profiles", and I I can save this Profile data, but what I am not quite sure is if its a temporary measure or if it does record to the database.

I could make my own custom membership system, use the built it and adapt it or use the user profiles. What is the best course of action? I'd vastly prefer to adapt/edit the built in Membership system and add the data I require to it but I still don't haven't a clear answer to what I should do or what's best.

2 Answers 2

1

You have two choices:

  1. Create a CustomMembershipProvider , and if you need to a CustomRoleProvider, you can do this by implementing .NET's MembershipProvider. Sample: http://www.codeproject.com/Articles/165159/Custom-Membership-Providers

  2. Create a separate table that stores additional user information, i.e., "BranchID", and add a one-to-one relationship between your table and .NET's Membership

It's really up to you which one you choose.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot for the links. Reading into them now :)
0

MembershipProvider is pretty easy to extend. Assuming the branch is something they have to select to authenticate? You should be able to extend authenticate to do something like:

public class MyCustomMembershipProvider : MembershipProvider
{
/*
....
*/
    public bool ValidateUser(string username, string password, string branch)
    {
        return (::ValidateUser(username, password) && MyCustomRoutine(username, branch));
    }

}

3 Comments

Would this change be recorded in the database? AKA... permanently? I need to identify which branch the user belongs to so I can display certain information specific to that branch only.
based on this comment it sounds like you are actually treating branch as a role, and then using that role to drive action filters. You might want to look into action filters too.
I had already looked into roles, and actually played with them a bit. Will look into Action Filters then!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.