Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.net mvc codefirst and authentication

Tags:

asp.net-mvc

I am a new Asp.net Mvc programmer and I am developing a web site with the use of code first entity framework.

I know that there is a built in membership provider inside mvc project and even I can use custom membership provider in order to change it to my taste.

but I am not sure if it is better to forget about membership provider and implement all of them (login,authentication,...)by myself to have better integrity? which is time consuming.

Could you plz tell me which one is better.

Regards

like image 382
Elham Avatar asked Dec 01 '25 05:12

Elham


1 Answers

There is a SQL membership provider (http://msdn.microsoft.com/en-us/library/system.web.security.sqlmembershipprovider.aspx) that comes with the .NET framework that you can use. I would take a closer look at that. If it doesn't fit your needs, then build your own.

I always build my own as I like to have complete control over the data model. Most sites I work on, I only need to implement ValidateUser() in the membership provider, but what all you need to implement purely depends on what you are using the membership provider to do. I use the YAGNI approach when it comes to implementing providers. I only implement methods that I know are going to be called.

If this is for a product you are building, then I would go ahead and implement everything as you never know what other developers might use your product for.

like image 166
Brian Ball Avatar answered Dec 07 '25 23:12

Brian Ball



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!