two Membership Providers at the same time for authentication within the same application

Last post 04-18-2008 1:08 PM by priyankpatel. 2 replies.

Sort Posts:

  • two Membership Providers at the same time for authentication within the same application

    03-25-2008, 9:28 PM
    Step 1: I would like to use Ldap and validate user against domain (just validation to see if you has correct credentials)Step 2: If user authenticated in step 1 than I would like to just check to see if user allow accessing an application. Password would not require or just ignore during validate user call. I would like to use SqlMembershipProvider with FormsAuthentication.Is it possible?

     

     

     

    Priyank
  • Re: two Membership Providers at the same time for authentication within the same application

    03-26-2008, 9:04 AM
    Answer
    • Loading...
    • deblendewim
    • Joined on 12-20-2006, 4:32 PM
    • Antwerp, Belgium
    • Posts 951

    Hi,

    I would just go for the LDAP authentication of the users. Then just use a method or something called: CheckUserAccess(username) (this is just a method I made up!)

    I do almost something simular in a webapplication. For this I override the login event:

     

    	Protected Sub LoginControl_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles LoginControl.Authenticate
    If ValidateUser(Me.LoginControl.UserName, Me.LoginControl.Password) Then
    If
    UserInAppDb(Me.LoginControl.UserName) Then
    e.Authenticated = True
    Else
    e.Authenticated = False
    Me
    .LoginControl.FailureText = "You are not known in the application DataBase. Please contact IT Helpdesk."
    End If
    Else

    e.Authenticated = False
    Me
    .LoginControl.FailureText = "You are not an Authenticated User. Please contact IT Helpdesk."
    End If
    End Sub

     

    You can find the validateUser method in the System.Web.Security.Membership. The UserInAppDb is my custom method that checks to see if the user has access to the application.

     

    Kind regards,
    Wim

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: two Membership Providers at the same time for authentication within the same application

    04-18-2008, 1:08 PM

    Thank you Wim for you reply. I will will go ahead and try

    Priyank
Page 1 of 1 (3 items)
Microsoft Communities
Page view counter