Jacksonville Developers User Group

Learn new things...write better code.
Welcome to Jacksonville Developers User Group Sign in | Join | Help
in
Home Blogs Forums

Get UserID

Last post 08-18-2008, 1:39 PM by tbates. 5 replies.
Sort Posts: Previous Next
  •  06-21-2008, 8:54 PM 2297

    • TM2 is not online. Last active: 06-23-2008, 11:07 PM TM2
    • Top 10 Contributor
    • Joined on 08-15-2007
    • Brunswick, Ga
    • Posts 32
    • Points 0

    Get UserID

    I am trying to get a UserID from the tblMembership table using a login name and password.

    Using the two parameters, no results.

    Using only login name, 1 result returned.

    What is wrong with the following statement?

    Select UserID From tblMembership Where UserName=@Login And Password=@Pwd

     

    This one works - Select UserID From tblMembership Where UserName=@Login

  •  06-22-2008, 11:29 AM 2298 in reply to 2297

    Re: Get UserID

    is it possible that the password is hashed and you are trying to compare an unhashed value to the hashed value stored in the database?

    The Universe has no center and I am it.



    The superior man is modest in his speech, but exceeds in his actions.

  •  06-23-2008, 9:34 AM 2299 in reply to 2298

    • TM2 is not online. Last active: 06-23-2008, 11:07 PM TM2
    • Top 10 Contributor
    • Joined on 08-15-2007
    • Brunswick, Ga
    • Posts 32
    • Points 0

    Re: Get UserID

    You got it!  You guys are a wealth of information.

    Sooo, how does one compare hash/unhashed values?

  •  06-23-2008, 8:28 PM 2301 in reply to 2299

    Re: Get UserID

    Are you using the ASP.NET Membership API or is this a hand-rolled membership solution?  Essentially, you are going to have to hash the passwords.  You'll need a mechanism to hash it in the same way that it is hashed for storage.

    I might look at how accounts are created in the first place.  Or maybe I am getting too far ahead of myself.  Maybe a better question is "what are you trying to do?"

    The Universe has no center and I am it.



    The superior man is modest in his speech, but exceeds in his actions.

  •  06-23-2008, 11:07 PM 2303 in reply to 2301

    • TM2 is not online. Last active: 06-23-2008, 11:07 PM TM2
    • Top 10 Contributor
    • Joined on 08-15-2007
    • Brunswick, Ga
    • Posts 32
    • Points 0

    Re: Get UserID

    I'm using the ASP.NET Membership API

    What I'm trying to do is - return the UserID for a given user's login & password.

  •  08-18-2008, 1:39 PM 2339 in reply to 2303

    Re: Get UserID

    To the ASP.NET Membership API the "user's login" is the UserID. 

    If you want to programmatically validate a user try:

    Membership.ValidateUser(username, password)

    And then to retrieve the user object try:

    Membership.GetUser() <--- gets current user

    Membership.GetUser(username) <--- if you want a user other than the current.


    There are only 10 types of people in the world: Those who understand binary, and those who don't
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems