public ActionResult GetValidateCode() { try { CaptchaHelper captcha = new CaptchaHelper(); string code = captcha.CreateVerifyCode(4); byte[] bytes = captcha.CreateImageCode(code); return(File(bytes, "image/jpeg")); } catch (Exception ex) { return(Content(string.Format("{0}++++++{1}{2}", ex.Message, System.Environment.NewLine, ex.StackTrace))); } }