public FileResult Captcha() { string num = Core.RandomTo.NumCode(4); byte[] bytes = ImageTo.Captcha(num); HttpContext.Session.SetString("captcha", Core.CalcTo.MD5(num.ToLower())); return(File(bytes, "image/jpeg")); }
/// <summary> /// 注册验证码 /// </summary> /// <returns></returns> public FileResult RegisterCode() { //生成验证码 string num = RandomTo.NumCode(4); HttpContext.Session.SetString("RegisterCode", num); byte[] bytes = ImageTo.Captcha(num); return(File(bytes, "image/jpeg")); }