Results 1 to 3 of 3

Thread: [RESOLVED] Asp membership get userid of user when not logged in

  1. #1

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727

    Resolved [RESOLVED] Asp membership get userid of user when not logged in

    Hi,

    Im creating a few web services for use with a mobile application. My current site uses asp .net membership and one of the web services will validate username and password.

    In the web service I get passed uname and pword and just use

    Code:
            If Membership.ValidateUser(username, password) = True Then
                Return "True"
            Else
                Return "false"
            End If
    Is there a similar way to get the userid without logging the user on or do I need to create a Stored procedure?

    Thanks Dave

  2. #2

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727

    Re: Asp membership get userid of user when not logged in

    I've answered my own question

    Code:
    If Membership.ValidateUser(username, password) = True Then
                Dim Member As MembershipUserCollection = Membership.FindUsersByName(username)
                Dim g As MembershipUser = Member.Item(username)
                Return g.ProviderUserKey.ToString
            Else
                Return "false"
            End If
    Any comments/improvements are welcome!

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] Asp membership get userid of user when not logged in

    I guess the only comment would be why convert to a String? Assuming you can transfer a Guid across a web service, why not leave it as a guid?

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width