Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Using a custom user database (should I use a custom MembershipProvider)

Using a custom user database (should I use a custom MembershipProvider)

Scheduled Pinned Locked Moved ASP.NET
databasecsharpasp-netsql-serverdesign
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MY1201
    wrote on last edited by
    #1

    Hello fellow developers! I'm currently working on a website in which users should be allowed to log in. We have an existing user database (SQL Server 2000), and I would like to use this database along with the ASP.NET login controls. Is this possible? I've been researching and found out that a possible solution would be to implement my own version of the MembershipProvider abstract class. Before I wander down that dirty dark road, I would like to know, if there is an easier way. I thought perhaps it would be possible to configure the SqlMembershipProvider to fit my needs. We are unable to change the design of the database since it is part of an existing system. Best regards Soeren

    N 1 Reply Last reply
    0
    • M MY1201

      Hello fellow developers! I'm currently working on a website in which users should be allowed to log in. We have an existing user database (SQL Server 2000), and I would like to use this database along with the ASP.NET login controls. Is this possible? I've been researching and found out that a possible solution would be to implement my own version of the MembershipProvider abstract class. Before I wander down that dirty dark road, I would like to know, if there is an easier way. I thought perhaps it would be possible to configure the SqlMembershipProvider to fit my needs. We are unable to change the design of the database since it is part of an existing system. Best regards Soeren

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      If you're looking to use the existing database for login validation then all you need to do is handle the OnLogin event of the Login Control and authenticate against it. No need to implement a Membership Provider.


      only two letters away from being an asset

      M 1 Reply Last reply
      0
      • N Not Active

        If you're looking to use the existing database for login validation then all you need to do is handle the OnLogin event of the Login Control and authenticate against it. No need to implement a Membership Provider.


        only two letters away from being an asset

        M Offline
        M Offline
        MY1201
        wrote on last edited by
        #3

        Okay. Looks nice. I assume this is what you want me to do:

        <asp:Login runat="server" ID="loginBox" OnLoggingIn="LogMeIn">
        </asp:Login>

        And in the "LogMeIn" function I should implement my login validation. Can I be sure, that this will override whatever build in authenticate methods the login contol may have? The reason I'm asking is because the standard setup seems to work against some database in my App_Data folder, without any code at all. Best reagards Soeren

        M 1 Reply Last reply
        0
        • M MY1201

          Okay. Looks nice. I assume this is what you want me to do:

          <asp:Login runat="server" ID="loginBox" OnLoggingIn="LogMeIn">
          </asp:Login>

          And in the "LogMeIn" function I should implement my login validation. Can I be sure, that this will override whatever build in authenticate methods the login contol may have? The reason I'm asking is because the standard setup seems to work against some database in my App_Data folder, without any code at all. Best reagards Soeren

          M Offline
          M Offline
          MY1201
          wrote on last edited by
          #4

          Oh well stupid me just found out what I think you meant! ;) The solution must be to inherit the Login class, and implement your own version of

          protected void OnAuthenticate(AuthenticateEventArgs e)

          Inside this you do your user validation stuff and set the "e.Authenticated" property to true - if the user validates of course - otherwise false. It seems to do the trick for me.

          If (I'm totally wrong)
          please correct me! :-);

          Best regards Soeren

          N 1 Reply Last reply
          0
          • M MY1201

            Oh well stupid me just found out what I think you meant! ;) The solution must be to inherit the Login class, and implement your own version of

            protected void OnAuthenticate(AuthenticateEventArgs e)

            Inside this you do your user validation stuff and set the "e.Authenticated" property to true - if the user validates of course - otherwise false. It seems to do the trick for me.

            If (I'm totally wrong)
            please correct me! :-);

            Best regards Soeren

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            Not at all what I meant. 1) Drop the login control on you page 2) Implement OnLoggingIn handler 3) Authenticate user in any way you choose 4) Call FormsAuthentication.RedirectFromLoginPage Simple as that, no need to create a derived class


            only two letters away from being an asset

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups