public async Task <ActionResult> Register(RegisterViewModel model) { string captchaResponse = Request.Form["g-Recaptcha-Response"]; string secretKey = @SettingHelper.Get("Recaptcha Secret Key"); try { var result = ReCaptchaValidator.IsValidAsync(captchaResponse, secretKey); if (result.Success && ModelState.IsValid && SettingHelper.Get("Recaptcha Site Key").HasValue()) { return(await ProcessRegistration("_RegistrationForm", model)); } if (!result.Success) { foreach (string err in result.ErrorCodes) { ModelState.AddModelError("", err); } } } catch (Exception ex) { var msg = ex.Message; } return(View("_RegistrationForm", model)); }