In This Code i am Providing the code by which the user can easily registered to the Website and the E-Mail is sent to the user for the Verification. If the user will not verify his/her email,the account is not activated and that person cannot login.
Here are the Following Steps to achieve that:-
1.Create new Web application and make one form in which the user can register and add the following code to the source code:
//Send email to user for verifying account
CreateUserWizard cuw = (CreateUserWizard)sender;
MembershipUser user = Membership.GetUser(cuw.UserName);
Guid userId = (Guid)user.ProviderUserKey;
System.Net.Mail.MailMessage EmailMsg = new System.Net.Mail.MailMessage("email@example.com",
EmailMsg.Subject = "Email Verification fromhttp:dinesh-itsolutions.blogspot.com/";
EmailMsg.IsBodyHtml = true;
EmailMsg.Body = "Thanks for registering with www.http://dinesh-itsolutions.blogspot.com/!<br /><br />Your activation link : <a href=http://http://dinesh-itsolutions.blogspot.com/?ID=" + userId.ToString() + ">Link</a>.";
System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient();
//This object stores the authentication values
System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential("smtpserverinfo", "smtpserverpassword");
mailClient.Host = "mail.ask.com";
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = basicAuthenticationInfo;
2.By the code the email is sent to the user with the unique link.
3.When the user check his/her mail and click on the activate link then it will redirected to the new webpage
now retrieve that unique id from the URL.
4.After Retrieving the Id'...just set the stutus of the Client from 0 to 1 in the database so that the person can login.
Enjoy ....................n in case if any query then ask me......