Creating an activation link for an account

  • Thread starter Thread starter Andy B
  • Start date Start date
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.
 
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.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

********************************************
| Think outside the box! |
********************************************
 
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.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

********************************************
| Think outside the box! |
********************************************
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.
 
Back
Top