/// <summary> /// 验证码 /// </summary> /// <returns></returns> public FileContentResult ValidateCode() { string code = ""; System.IO.MemoryStream ms = new Models.verify_code().Create(out code); Session["gif"] = code; Response.ClearContent(); return(File(ms.ToArray(), @"image/png")); }
public FileContentResult ValidateCode() { string code = string.Empty; System.IO.MemoryStream ms = new Models.verify_code().Create(out code); Session["gif"] = code; //验证码存储在Session中,供验证 Response.ClearContent(); //清空输出流 return(File(ms.ToArray(), @"image/png")); }