2

I m developing MVC3 application with SQL Server. For security I am using form based authentication (I need to provide authentication and authorization in application).

Currently user are being managed in aspnet_users table by Membership api. I am not getting any other option but to add columns in aspnet_users table.

I need to add the following other columns in aspnet_users table:

  1. CreatedBy User id which create User
  2. CreatedOn DateTime
  3. EditedBy User id
  4. EditedOn DateTime
  5. IP Address

I am thinking to write own methods to add these records and not try to disturb aspnet stored procedres.

Any gideance or advice please ? I m sure developers will have such needs.

user576510
  • 5,379
  • 18
  • 74
  • 137
  • 3
    No, I would recommend against this. You should regard these tables as a "custom, third-party" component - leave it alone. If you need additional info - create your own tables and just reference the existing tables (foreign keys). I would never modify a third-party provided schema - what happens when the next update of that schema is delivered by that third party?? – marc_s Aug 30 '12 at 07:14
  • No, its not a good idea - marc_s is right, in .NET 4.5 the membership table structure changes entirely. Have a look at this: http://stackoverflow.com/questions/11344585/how-to-extend-aspnet-membership-forms-authentication-tables/11344642#11344642 – StuartLC Aug 30 '12 at 07:17

1 Answers1

2

You should use the Membership User Profile API to extend custom properties to your users, and not directly add columns to the aspnet_Membership and aspnet_Users tables.

Take a look at Defining ASP.NET Profile Properties, this should be all you need.

Also by default, each user has a Comment column that you could add whatever you want to it in a string.

There is also a Web Profile Builder for Web Application Projects but I don't think you'll need to go that route.

Garrett Fogerlie
  • 4,400
  • 3
  • 32
  • 55