Professional Documents
Culture Documents
Send User Activation Email After Creating An Account
Send User Activation Email After Creating An Account
Send User Activation Email After Creating An Account
}
and in activate.aspx:
———Second Way———–
}
and in activate.aspx:
——–Third Way——–
**
<asp:CreateUserWizard ID=”CreateUserWizard1″ runat=”server” LoginCreatedUser=”false”
DisableCreatedUser=”true”
MailDefinition-BodyFileName=”signupmail.txt”
OnSendingMail=”CreateUserWizard1_OnSendingMail”>
<WizardSteps>
<asp:CreateUserWizardStep ID=”CreateUserWizardStep1″ runat=”server”>
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep ID=”CompleteWizardStep1″ runat=”server”>
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
**
signupmail.txt:
Thank you for signing up for a new account at my site. To complete your registration, please follow the link
below:
http://www.mysite.com/authorise.aspx?u=<%NEWUSERID%>
**
protected void CreateUserWizard1_OnSendingMail(object sender, MailMessageEventArgs e)
{
// Create an SQL connection object
using (SqlConnection conn = new
SqlConnection(ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString))
{
// Create a command to get the user ID of the new user
SqlCommand command = new SqlCommand(”SELECT m.UserId FROM aspnet_Membership m
INNER JOIN aspnet_Users u ON m.UserId = u.UserId WHERE u.LoweredUserName=
LOWER(@UserName) AND m.Email = @Email AND m.IsApproved = 0″,conn);
if (reader.HasRows)
{
// Read the next row
reader.Read();
**
In authorise.aspx Page
conn.Open();
command.ExecuteNonQuery();
conn.Close();
}