Using System.Management;
protected void Page_Load(object sender, EventArgs e)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
String cpuName = string.Empty;
ManagementObjectSearcher searcher = new ManagementObjectSearcher(" select * from Win32_Processor");
foreach (ManagementObject o in searcher.Get())
{
sb.AppendFormat("{0}", o.ToString());
foreach (PropertyData prop in o.Properties)
{
sb.AppendFormat("Name: {0} Value : {1}
", prop.Name, prop.Value);
if (prop.Name == "Name")
cpuName = (String)prop.Value;
}
}
sb.Insert(0, String.Format("
Response.Write(sb.ToString());
OSlabel1.Text = System.Environment.OSVersion. ToString();
OSVersionlabel1.Text = System.Environment.Version. ToString();
RegistryKey Rkey = Registry.LocalMachine;
Rkey = Rkey.OpenSubKey("HARDWARE\\ DESCRIPTION\\System\\ CentralProcessor\\0");
CPUInfolabel1.Text = (string)Rkey.GetValue(" ProcessorNameString");
oskey.Text = System.Environment. SystemDirectory.ToString();
}
protected void Page_Load(object sender, EventArgs e)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
String cpuName = string.Empty;
ManagementObjectSearcher searcher = new ManagementObjectSearcher("
foreach (ManagementObject o in searcher.Get())
{
sb.AppendFormat("{0}", o.ToString());
foreach (PropertyData prop in o.Properties)
{
sb.AppendFormat("Name: {0} Value : {1}
", prop.Name, prop.Value);
if (prop.Name == "Name")
cpuName = (String)prop.Value;
}
}
sb.Insert(0, String.Format("
{0}
", cpuName));Response.Write(sb.ToString());
OSlabel1.Text = System.Environment.OSVersion.
OSVersionlabel1.Text = System.Environment.Version.
RegistryKey Rkey = Registry.LocalMachine;
Rkey = Rkey.OpenSubKey("HARDWARE\\
CPUInfolabel1.Text = (string)Rkey.GetValue("
oskey.Text = System.Environment.
}
No comments:
Post a Comment