我正在尝试通过我的代码连接到打印机,然后在打印机上应用安全设置。在应用安全功能之前,它会在以下代码模块中检查密码。代码在行后挂起
流.Flush()
if (responseStr.IndexOf(PrinterSecurityConstants.NewPrinterPass) > 0)
{
LogUtility.Info(PrinterSecurityConstants.ValidateUserNamePassword);
data = System.Text.Encoding.ASCII.GetBytes(
ConfigurationManager.AppSettings[PrinterSecurityConstants.CurrentPass]
.ToLower() + CommonConstant.Carriagereturn);
stream.Write(data, 0, data.Length);
stream.Flush();
bytes = stream.Read(dataResponse, 0, dataResponse.Length);
responseStr = System.Text.Encoding.ASCII.GetString(dataResponse, 0, bytes);
}
我需要做什么才能使此代码有效。