public ActionResult Register(RegisterModel model)
        {
            if (User.Identity.IsAuthenticated)
            return RedirectToHome();

              if (ModelState.IsValid)
              {
            // Attempt to register the user
            try
            {
              WebSecurity.CreateUserAndAccount(model.UserName, model.Password, new { EMail = model.EMail });
              WebSecurity.Login(model.UserName, model.Password);
              return Configuration.Settings.RegisterSuccessUrl.Redirect();
            }
            catch (MembershipCreateUserException ex)
            {
              ModelState.AddModelError("", ErrorCodeToString(ex.StatusCode));
            }
            catch (InvalidUserNameException)
            {
              ModelState.AddModelError("UserName", _.AuthWeb.InvalidUserName);
            }
              }

              // If we got this far, something failed, redisplay form
              return View(model);
        }
        public ActionResult Register()
        {
            if (User.Identity.IsAuthenticated)
            return RedirectToHome();

              RegisterModel model = new RegisterModel();
              return View(model);
        }