approve the user with email?

Last post 05-14-2008 3:22 PM by yasserzaid. 4 replies.

Sort Posts:

  • approve the user with email?

    05-02-2008, 1:24 PM
    • Loading...
    • DrZ3D
    • Joined on 07-11-2007, 5:55 PM
    • Posts 97

    hi

    when the users register in my website they resive an email. in this email is a link like page.aspx?ID=ce01cfb1-0a10-467f-94da-c32da3121b7f . after the user click on this link he will go to the page.aspx and in this page i wanna set the user IsApproved=True.

     

    in the page.aspx in page load event i write some code like:

    Dim RequestUserID As String = Page.Request.QueryString("ID")

    Dim user As MembershipUser = Membership.GetUser(RequestUserID)

     

    user.IsApproved = True

    Membership.UpdateUser(user)

    at line 2 i wanna get the user by userID please help me to write it.

    thanks

  • Re: approve the user with email?

    05-02-2008, 7:02 PM
    Answer
    • Loading...
    • AceCorban
    • Joined on 08-23-2007, 3:43 PM
    • Monterey, CA
    • Posts 536

    From the sound of it, there is no direct link between this GUID you have and a User.  You may need to build an association table.  You would populate this table when the user registers with their new userId and the GUID you generate.  Then, when they click the link in their email, you would query that association table to find which UserId is assocaiated to the GUID in the querystring.  From there, you can update the user table.

     

    Another option would be to perhaps pass them a different code that is a mix of their UserId, a timestamp and a guid.  Then you would simply know where in the string their userId is placed.  That may be pretty easily exploited though.

    I never lose, some people are just better than me at winning.
  • Re: approve the user with email?

    05-03-2008, 10:45 AM
    • Loading...
    • DrZ3D
    • Joined on 07-11-2007, 5:55 PM
    • Posts 97

    the querystring is the user ID (that creat with .Net 2.0 Membership Provider)

    i think there is a class to get the user with user id in Membership Provider classes.

    i just wanna to know how can i find the user with user ID?

    if i find the user i will change my code to know if the user exist than i will update the user as aproved user.

  • Re: approve the user with email?

    05-03-2008, 3:48 PM
    • Loading...
    • TorLanglo
    • Joined on 09-08-2006, 8:24 PM
    • Salt Lake City, UT
    • Posts 14

    I think what you're looking for is

    Membership.Provider.GetUser(...);

    Tor.

    --------
    Tor Langlo
    Koda Software
    Web: http://www.kodasoftware.com
    Blog: http://torlanglo.spaces.live.com
  • Re: approve the user with email?

    05-14-2008, 3:22 PM
    Answer

    try this

     

    Dim RequestUserID As New Guid(Page.Request.QueryString("ID")) 
    
    Dim user As MembershipUser = Membership.GetUser(RequestUserID) 
    
    Dim email As String = user.Email 
    
    user.IsApproved = True 
    
    Membership.UpdateUser(user)
     
    Regards,
    Yasser Zaid

    ~ Please remember to click Mark as Answer on this post if it helped you ~
Page 1 of 1 (5 items)
Microsoft Communities
Page view counter