public CaptchaResultModel GetCaptcha() { var randomValue = CaptchaHelper.GetValidateCode(5); var imageData = CaptchaHelper.CreateBase64Image(randomValue); var key = Guid.NewGuid().ToString(); _cachingProvider.Set(key, randomValue, TimeSpan.FromMinutes(2)); return(new CaptchaResultModel(key, imageData)); }
public async Task <CaptchaResultModel> GetCaptcha() { var randomValue = CaptchaHelper.GetValidateCode(5); var imageData = CaptchaHelper.CreateBase64Image(randomValue); var key = Guid.NewGuid().ToString(); await _cachingProvider.SetAsync(key, randomValue, TimeSpan.FromMinutes(2)); return(new CaptchaResultModel { CaptchaKey = key, CaptchaData = imageData }); }