我正在运行这段代码。
server.Open();
//Console.WriteLine("----------------------------------------------------");
//Console.WriteLine("Active users on {0}", machineName);
foreach (ITerminalServicesSession session in server.GetSessions())
{
System.Security.Principal.NTAccount account = session.UserAccount;
if (account != null)
{
if (session.ConnectionState == Cassia.ConnectionState.Active)
{
((TextBox)Page.FindControl("txt" + machineName.Substring(7))).Text += session.UserName + " idle " + session.IdleTime.TotalMinutes + " minutes" + "\r\n";
}
}
}
它在控制台应用程序中运行良好,但在 asp.net 页面中出现“没有更多可用数据”错误。