views:

121

answers:

2

How can I configure membership provider to insert data on my own database

+2  A: 

Write a custom Membership Provider to use your custom database (if you want to use a completely different database schema) or follow the steps here:

How Do I Change My ASP.NET Membership Database

Justin Niessner
This is solved my problem: http://www.integratedwebsystems.com/2010/02/how-to-setup-and-configure-mysql-membership-provider-6-2-2-porting-to-mono-part-2-of-3/#
Ognjen
A: 

You can create a custom MembershipProvider to deal with a custom authentication system. You have to implement a bunch of methods. Here is an example

public class DreemMembershipProvider : MembershipProvider
{
...
   public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
   {
       //your code to insert a user in the db.
   }

   public override bool ValidateUser(string username, string password)
   {
         //your code to check the user and pass against your db 
   }
   ...
}

finally you have to set your app to use your membership provider -> in the web.config

Svetlozar Angelov
I use mySql database and Asp.net mvc with automatic generated account controller and i have store info about user in mylqs database
Ognjen
I am not aware of Mysql Membership providers for asp.net (that doesn't mean there isn't one), but a solution would be code your custom authentication system. You just need to write the implementation of the MemberShipProvider methods for writing and reading from the db
Svetlozar Angelov
When you change the membership provider to be your own custom one, all methods from the "generated" account controller will use the methods in your custom MemberShip Provider. I think this is what you want...
Svetlozar Angelov
when i for example register one user he showed on ainimdstrative tools but not in mysql database
Ognjen