VS 2010 Customizing SimpleMembership Provider-VBForums
Results 1 to 4 of 4

Thread: Customizing SimpleMembership Provider

  1. #1

    Thread Starter
    Fanatic Member bharanidharanit's Avatar
    Join Date
    Oct 2008
    Location
    India
    Posts
    673

    Customizing SimpleMembership Provider

    I am using simple membership provider in mvc4 application and I can see five tables generated for that. In that i can see username and password are stored on different tables. I want to save username and password on the same table with some custom fields. So I am creating my own Membership Provider by inheriting ExtendingMembership Provider. I have some queries over that.

    1. My application uses 3-tier architecture(BLL, DAL and Presentation layers) and created 2 areas for account and admin. So here i dont know where to place my membership provider which are then accessed with every part of application for using Authorize Attribute.

    1. I am overriding this method CreateUserAndAccount, Do i need to implement my own logic for saving user registration datas to database. But i find only some parameters are passed, how to pass my remaining custom fields from view to the controller using the dictionary object ?

    Code:
    public override string CreateUserAndAccount(string userName, string password, bool requireConfirmation, IDictionary<string, object> values) { throw new NotImplementedException(); }

  2. #2
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,498

    Re: Customizing SimpleMembership Provider

    Membership providers are defined in web.config.

    I have to ask why you would need/want to write your own provider, unless it's for a custom data store. Security/crypto is too easy to get wrong and you should not DIY unless you "really" know what you're doing. Is there a reason why you can't use the default provider implementation?
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Re: Customizing SimpleMembership Provider

    Even if you create your own custom membership provider, you shouldn't use USERS table to store extra fields. You can either implement your own custom PROFILE provider (as I did) or just use a built in provider that comes with ASP.NET Membership Provider. Although I would not recommend it. Built in profile provider is just horrible. Some genius' at microsoft thought it would be very cool to store all properties as ROWS in the table, making this profile provider completely unusable in moderate-to-heavy load environment.

  4. #4
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,498

    Re: Customizing SimpleMembership Provider

    Quote Originally Posted by Serge View Post
    Some genius' at microsoft thought it would be very cool to store all properties as ROWS in the table, making this profile provider completely unusable in moderate-to-heavy load environment.
    Not even for a moderate load environment. I don't think it's usable in "any" environment.

    Your best option for storing custom data related to a user is to make a separate table with the required fields and use the GUID user id as the primary key. Link that to the Users table provided by the default membership provider with FK relation to it's UserId field. No need to bother with creating a custom "profile provider". If you set the FK relation to CASCADE DELETE, then the associated row in your separate table will be removed automatically when a user is removed from the Users table by the membership provider.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.