Membership Change. ValidateUser () and other things in ASP.NET MVC 3

Is there a way to change the ValidateUser method in MVC 3? For example .. requires an additional parameter, such as an identification number or something like that? I feel this stuff is pretty static ...

Oh, and is there a way to use a different database than the existing mdf + ldf SQL database (e.g. MySQL DB)?

Edit: I still have problems setting up this stuff.

In my BOMembershipProvider class, I have

  using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;
 using System.Web.Security;

 namespace MVCTests
 {
     public class BOMembershipProvider: MembershipProvider
     {
         public override string ApplicationName

etc. It is located in the App_Data folder. My Web.config is as follows:

<membership defaultProvider="BOMembershipProvider"> <providers> <clear/> <add name="BOMembershipProvider" type="BOMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> </providers> 

He still gives me an error with the type of thing not found. Any hints, solutions, ...?

Oh, and I tried this with MVCTests.BOMembershipProvider in Web.config too, without any results: (

+4
source share
1 answer

You can write your own membership provider to change the behavior of ValidateUser. It will also allow you to use a different database provider.

See http://msdn.microsoft.com/en-us/library/aa479048.aspx or asp.net custom membership provider.

This example of a custom membership provider that uses the framework codefirst entity helped me get started:

http://codefirstmembership.codeplex.com/

+4
source

All Articles