Custom user model (for custom fields, etc) with ASP.NET MVC
I'm working on a ASP.NET MVC 2 application and used the default project skeleton with forms authentication. I have two requiremen开发者_如何学Pythonts, the first is that it has to work on a Mono environment (ex. to run it within Apache) and the second is that I need a custom user model or at least, append additional information to the user information so I can access such data during runtime/session-time.
I've been searching for existent answers covering this scenario and couldn't find anything final. I'm not sure if I will need to provide my own Membership provider or take a different route to solve the problem.
Thanks!
As far as I can tell, the aspnet_Profile
table is supposed to be used for this. Take a look at this example of adding a pet to a user profile. You are of course free to add your own implementation for the custom data -- you could link it with a foreign key to the [aspnet_Users].[UserId]
column and do whatever you like.
精彩评论