Creating an activation link for an account

A

Andy B

I am working on a mailing list service for our company. One of the
requirements is that when a person signs up for a mailing list through the
website they have to activate their subscription through a link sent to them
in an email. How would I do something like this? The db being used is sql
server 2005 express.
 
C

Cowboy \(Gregory A. Beamer\)

When the person creates the account, create a GUID for the user. The easiest
way, in SQL Server (Express or otherwise) is to set a column up with
IsRowGuid = true. You will also want a column named IsConfirmed as a bit and
defaulted to 0. Something like:

ALTER TABLE Users
ADD
[ConfirmId] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT
[DF_Users_ConfirmId] DEFAULT (newid()),
[IsConfirmed] [bit] NOT NULL CONSTRAINT [DF_Users_IsConfirmed] DEFAULT
((0))


Then send an email with a link like this:
http://www.yourcompany.com/confirm.aspx?id={the_guid_here}

When they click on the link, you have code that updates IsConfirmed to 1
(true). You then have to alter the logon mechanism to respect that field. If
you are using ASP.NET Membership, create a custom membership provider rather
than whack any bits Microsoft created. As a personal note: There is nothing
more aggrevating, as a consultant, than coming in and finding that the
errors you are experiencing are due to someone whacking standard bits rather
than deriving their own classes. In addition, these whack jobs are rarely
documented, so they can cause great pain to the company when they have to
move the application to another server or get new developers on it years
later.
 
A

Andy B

Ill look into it and see how it goes. I wont be using the standard
membership providers for the mailing list service and I am going to be
revamping the website this off season anyways so can make some better
improvements along with another major project I have to do.


Cowboy (Gregory A. Beamer) said:
When the person creates the account, create a GUID for the user. The
easiest way, in SQL Server (Express or otherwise) is to set a column up
with IsRowGuid = true. You will also want a column named IsConfirmed as a
bit and defaulted to 0. Something like:

ALTER TABLE Users
ADD
[ConfirmId] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT
[DF_Users_ConfirmId] DEFAULT (newid()),
[IsConfirmed] [bit] NOT NULL CONSTRAINT [DF_Users_IsConfirmed] DEFAULT
((0))


Then send an email with a link like this:
http://www.yourcompany.com/confirm.aspx?id={the_guid_here}

When they click on the link, you have code that updates IsConfirmed to 1
(true). You then have to alter the logon mechanism to respect that field.
If you are using ASP.NET Membership, create a custom membership provider
rather than whack any bits Microsoft created. As a personal note: There is
nothing more aggrevating, as a consultant, than coming in and finding that
the errors you are experiencing are due to someone whacking standard bits
rather than deriving their own classes. In addition, these whack jobs are
rarely documented, so they can cause great pain to the company when they
have to move the application to another server or get new developers on it
years later.


Andy B said:
I am working on a mailing list service for our company. One of the
requirements is that when a person signs up for a mailing list through the
website they have to activate their subscription through a link sent to
them in an email. How would I do something like this? The db being used is
sql server 2005 express.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top