ASP.Net Authentication with MVC2--how to integrate with DB?
I'm trying to understand the authentication section of the sample project that opens in a new MVC2 project in VS2010. It essentially lets you register, login, etc. I looked through the code that imple开发者_如何学Cments this briefly, it looked fairly complicated. (10 tables, 40 sprocs, 10 views, 4 models, 1 model, 1 controller, etc.)
Is it best to utilize this provided framework for authentication? If so, how would I integrate this with my own database models (which has user and role tables, etc.). Also, if I use their framework, are there any performance issues at higher traffic volumes (like SO traffic levels for example), do I need to become responsible for maintaining/backing-up/optimizing the authentication DB as well in this case?
- The default MembershipProvider works fine at higher traffic volumes
- If the default provider does not suit your needs, then you can easily Implement a custom Membership Provider
- Using the provided interfaces and providers, you get many things for "free". Such as authentication-attributes and integrated security.
- I have never experienced any problems when integrating with custom database models.
I strongly recommend two articles, I've implemented my own providers based on fluentNhibernate + my own database structure:
- http://indomitablehef.com/?p=214 (series of posts)
- http://www.codeproject.com/KB/custom-controls/Fluent-MembershipProvider.aspx (how to write fluent nhibernate providers)
精彩评论