Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am trying to implement the register method with email confirmation, like this:

C#
[HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                //MembershipCreateStatus createStatus;
                using (db = new LolaBikeContext())
                {

                    UserProfile userEmail = db.userProfiles.FirstOrDefault(e => e.Email.ToLower() == model.Email.ToLower());
                    try
                    {
                        if (userEmail == null)
                        {
                            WebSecurity.CreateUserAndAccount(model.UserName, model.Password, new { model.Email }, false);
                            
               
                            WebSecurity.Login(model.UserName, model.Password);
                         
                         //WebSecurity.GeneratePasswordResetToken(model.UserName);
                            //return RedirectToAction("Index", "Home");
                        }
                        ModelState.AddModelError("", ErrorCodeToString(MembershipCreateStatus.DuplicateEmail));

                    }
                    catch (MembershipCreateUserException e)
                    {
                        ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                    }

                    
                }

            }


But how to get the email confirmation?

Thank you
Posted

1 solution

You cannot just "get" event confirmation. This is not how it works. If the server hosting e-mail of the addressee implements this feature and if it is enabled by their local policy, you will receive response (with some receipt) via e-mail at the sender's address. For further detail in requesting of confirmation and tracking, please see: http://en.wikipedia.org/wiki/Email_tracking[^].

Practically, you cannot rely on it. One typical case when people request confirmations and rely on them is sending messages within some corporation where the confirmation policy is united for all units and strictly enforced by corporate system administration.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900