/// <summary> /// 获取验证码 /// </summary> /// <returns></returns> public ActionResult GetValidateCode() { RandomCode randomCode = new RandomCode(); string code = randomCode.CreateValidateCode(6); Session["ValidateCode"] = code; byte[] bytes = randomCode.CreateValidateGraphic(code); return(File(bytes, @"image/jpeg")); }