本文介绍了如何获得系统信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生

我需要代码,以使我的个人计算机系统信息和操作系统的许可密钥在浏览器上显示,或使用.net以字符串格式显示.

所以请帮帮我


我得到了所有其他信息,但仍然没有得到我想要的摩托女巫.

我拥有XP Os的原始副本,因此,我希望使用.net
我的PC的产品密钥.

请帮帮我!


sir

i want code in that my personal computer system information and liecence key of my Operating system display on browser or in string format using .net

so please help me


i get every other information but still i didnt get my moto witch i want.

i hav leagal copy of XP Os so,i want product key of my pc using .net

please help me !


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Management;
using System.Management.Instrumentation;
using Microsoft.Win32;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        GetCPUData();
    }
    public void GetCPUData()
    {



        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}<p/>", o.ToString());

            foreach (PropertyData prop in o.Properties)
            {
                sb.AppendFormat("Name: {0} Value : {1}<br/>", prop.Name, prop.Value);
                if (prop.Name == "Name")
                    cpuName = (String)prop.Value;
            }
        }

        sb.Insert(0, String.Format("<h3>{0}</h3>", cpuName));

        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();

    }
}

推荐答案



这篇关于如何获得系统信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-18 05:35