public ActionResult CreateVerifyCode() { string code = CaptchaHelper.CreateVerifyCode(4); MemoryStream ms = CaptchaHelper.CreateVerifyCodeImg(code); TempData["verifyCode"] = code; //Session["verifyCode"] = verifyCode; return(File(ms, "image/jpeg")); }
/// <summary> /// 获取验证码 /// </summary> /// <returns></returns> public ActionResult GetVerifyCode() { string code = CaptchaHelper.CreateVerifyCode(4); TempData["verifyCode"] = code; var stream = CaptchaHelper.CreateVerifyCodeImg(code); return(File(stream, "image/jpeg")); }