Membership account email validation

Last post 07-08-2009 12:01 AM by venkatu2005. 4 replies.

Sort Posts:

  • Membership account email validation

    07-07-2009, 11:08 PM
    • Member
      19 point Member
    • ilearn
    • Member since 01-31-2008, 5:01 PM
    • Posts 49

    Hi all,

    I would like to create a form where users can enter a Full name, an email address and a password to create an account and after, an email will be send to the email address to validate the email in order to activate the account.

    Does anybody can point me to the right direction? Any help will be very welcomed.

    Tks all.

  • Re: Membership account email validation

    07-07-2009, 11:46 PM
    • Participant
      768 point Participant
    • zsuzen
    • Member since 09-25-2007, 3:28 PM
    • UK
    • Posts 150

    You can use aps.net membership feature. Search for "asp.net membership tutorial".

    As for email validation or confirmation (I can't remeber if this feature comes out of the box), I suggest to use a secret to generate a hash of email address and send that as a part of your confirmation url. That way you won't need to keep state on the server. Here is an example pseudo code:

    email = "example@example.com"

    secret = "somesecretstring"

    hash = md5(email + secret)

    link = "http://example.com/confirmation.aspx?email=" + email + "&hash=" + hash

    So on the confirmation page you can do the same thing and verify the hash and then flag the account as active using the membership api.

    Good luck.

    --ziya




  • Re: Membership account email validation

    07-07-2009, 11:48 PM
    • Contributor
      2,579 point Contributor
    • wmec
    • Member since 12-20-2007, 6:36 AM
    • China
    • Posts 1,593

    First you need to have your connection to Sql server (suppose that you're using that) and then have the web form.

    Next you can have your mail process to send the mail (see this example)

    CREATE PROCEDURE dbo.foo AS
    BEGIN
        SET NOCOUNT ON
        -- do some other actions
        DECLARE @body VARCHAR(1024)
        SET @body = 'foo was fired '+
            CONVERT(VARCHAR, GETDATE())
     
        EXEC master..xp_smtp_sendmail
            @TO = 'you@you.com',
            @from = 'someone@somewhere.com',
            @message = @body,
            @subject = 'foo was fired.',
            @server = 'smtp.yourdomain.com'
    END
     
    -- or you can do it conditionally:
     
    CREATE PROCEDURE dbo.foo AS
    BEGIN
        SET NOCOUNT ON
        -- do some other action
        IF @@ROWCOUNT > 0
        BEGIN
            DECLARE @body VARCHAR(1024)
            SET @body = 'foo was fired ' +
                CONVERT(VARCHAR, GETDATE()) +
                CHAR(13) + CHAR(10) + 
                CONVERT(VARCHAR, @@ROWCOUNT)
     
            EXEC master..xp_smtp_sendmail
                @TO = 'you@you.com',
                @from = 'someone@somewhere.com',
                @message = @body,
                @subject = 'foo was fired.',
                @server = 'smtp.yourdomain.com'
        END
    END

    Many Thanks & Best Regards,
    HuaMin Chen
    (If you mark it then it means the post is helpful/meaningful for other people's reference in the future!)
  • Re: Membership account email validation

    07-07-2009, 11:53 PM
    • Contributor
      2,579 point Contributor
    • wmec
    • Member since 12-20-2007, 6:36 AM
    • China
    • Posts 1,593

    First you need to have your connection to Sql server (suppose that you're using that) and then have the web form.

    Next you can have your mail process to send the mail (see this example)

    CREATE PROCEDURE dbo.foo AS
    BEGIN
        SET NOCOUNT ON
        -- do some other actions
        DECLARE @body VARCHAR(1024)
        SET @body = 'foo was fired '+
            CONVERT(VARCHAR, GETDATE())
     
        EXEC master..xp_smtp_sendmail
            @TO = 'you@you.com',
            @from = 'someone@somewhere.com',
            @message = @body,
            @subject = 'foo was fired.',
            @server = 'smtp.yourdomain.com'
    END
     
    -- or you can do it conditionally:
     
    CREATE PROCEDURE dbo.foo AS
    BEGIN
        SET NOCOUNT ON
        -- do some other action
        IF @@ROWCOUNT > 0
        BEGIN
            DECLARE @body VARCHAR(1024)
            SET @body = 'foo was fired ' +
                CONVERT(VARCHAR, GETDATE()) +
                CHAR(13) + CHAR(10) + 
                CONVERT(VARCHAR, @@ROWCOUNT)
     
            EXEC master..xp_smtp_sendmail
                @TO = 'you@you.com',
                @from = 'someone@somewhere.com',
                @message = @body,
                @subject = 'foo was fired.',
                @server = 'smtp.yourdomain.com'
        END
    END

    Many Thanks & Best Regards,
    HuaMin Chen
    (If you mark it then it means the post is helpful/meaningful for other people's reference in the future!)
  • Re: Membership account email validation

    07-08-2009, 12:01 AM
    Answer
    • All-Star
      21,070 point All-Star
    • venkatu2005
    • Member since 07-01-2008, 6:48 AM
    • Posts 4,586

    ilearn:
    I would like to create a form where users can enter a Full name, an email address and a password to create an account and after, an email will be send to the email address to validate the email in order to activate the account.

    When user Create a account. just a send an link with the userid as an email to the user so on that page , place the accept Button to continue with the account Confirmation so when her confirmed update database by setting boolean value 1 so initially it should be 0 .

    I have Changed My Blog from (http://venkat-dotnetsamples.blogspot.com) to (http://venkat-dotnetsnippets.blogspot.com)

    Regards,
    Venkatesan.M

    Please Mark as Answered If its helpful and Un-Mark as Answered if it not help u.
Page 1 of 1 (5 items)