Question

Single Application Page Asp.net MVC 4 temlplate uses default database to check Login and Register but I want to use my existing database in my SPA application. There are some table to store info like default database and some table to store other info in my database. So how can I do this? or I just have to use default database for Authorization and use my database to do business?

Was it helpful?

Solution

There are, as always several ways to accomplish this task.

Microsoft shows you an example using ASP.NET Membership and Roles as it's a powerful way to accomplish what you want, and it even provides you with a sample Database for that to work.

You have the ability to override all the methods that handle membership and roles in this way, you benifit from using ASP.NET Membership & Roles and use your own Database (or anything to keep your user information in a common place, like text File or Xml, you decide!)

For this, you can see my answer on how to create your own Membership Provider:

Custom MembershipProvider in .NET 4.0

I suggest that you read this answer to the end, as I have added a Video Tutorial on the subject that might help you seeing thing this in a different perspective and how easy is to implement this.


Or you can simple discharge the Provider and do and use your own method, like, validade user and password and keep a Session throughout the user livecycle that let you know the user information and if he's logged in or not...

As throughout this late years, Microsoft suggest that you use their way, but you have always the freedom to do things your way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top