private bool ActivateUser(string code) { try { var uu = new UserFactory(RegistryContext); user = uu.FindUserByActivationCode(Domain, code); user.ActivationCode = string.Empty; user.DeploymentState = DeploymentState.Deployed; user.Save(); return true; } catch (EntityNotFoundException) { return false; } }
protected void Page_Load(object sender, EventArgs e) { if (RegistryUser != null) { OldPasswordRow.Visible = true; user = RegistryUser; } else { OldPasswordRow.Visible = false; // Load user try { var uu = new UserFactory(RegistryContext); uu.FindUserByActivationCode(Domain, Request.QueryString["code"]); } catch (EntityNotFoundException) { throw new Registry.SecurityException("Access denied"); } } }