/// <summary> /// 生成验证码 /// </summary> /// <returns></returns> public byte[] GetValidateCode() { var strCode = CreateValidateCode(CodeLenght); if (string.IsNullOrEmpty(strCode)) { return(new byte[0]); } var imageByte = CreateValidateGraphic(strCode); if (imageByte == null || imageByte.Length <= 0) { return(new byte[0]); } var token = xnValidateCodeHandler.SetCode(strCode); XnAuthentication.SetValidateCookie(token); return(imageByte); }