How to send a confirmation link by email to a user

I am developing a website where I need to send a confirmation link to the user's email account when he signs up.

When the user clicks this link, the field userEnablein the database changes from "false" to "true".

How to send a confirmation email to the user when the user clicks the register button.

When the user clicks this confirmation link, how would the field change userEnablefrom "false" to "true"

I am using asp.net 4.0 with VB.NET as the language and SQL Server 2008 for my database.

+5
source share
5 answers

First you must create a User table in the database with a type column Active = falsein the database (the type of the database field is 1 bit). Then, after the user has created his account, you should send him an activation link with a query string containing the user's activation instructions. Sort of:

Please activate your account www.mysite.com?id=21EC2020-3AEA-1069-A2DD-08002B30309D

On the confirmation page, you check this request, for example

var id = Response.QueryString["id"]
if (id!= null) userBL.ActivateUser(id);

The ActivateUser () method will update the field to true, and also send a confirmation email.

+4
source

, nemke, , , , . , .

- :

userID: getUniqueUserID()
confirmed: false,
confirmCode: getRandomUUID()

confirmCode userID , , . URL- :

http://example.com/activate?id=43d24b9ca73&c=16b4cf80-c59a-11e2-8b8b-0800200c9a66

id userID, , c confirmCode , confirmed true .

+1

ID | | | UserEnabled

E-mail check this.

, UserEnabled true.

0

ASP.NET Built in Controls,

MailDefinition CreateUserWizard

The MailDefinition property returns a link to a group of properties that you use to determine the format and content of the email message that is sent to new users. General settings include subject line and sender address.

0
source
0
source

All Articles