Asp.Net(C#)实现在线检测系统信息

本文提供了一个Asp.Net(C#)实现的在线系统信息检测工具代码,通过该工具可以获取包括操作系统、硬件配置、系统服务及进程在内的多项系统信息。用户可以通过提供的测试地址在线检测自己的系统信息。

以下是Asp.Net(C#)实现在线检测系统信息的代码,能够轻松获取系统的硬件、系统服务、系统进程等信息。顺便发个测试地址http://www.mycjweb.com/pcinfo.aspx,在线测一测你的系统信息,省去安装系统检测软件的麻烦。不是很强大,有待进一步完善。

using System;
using System.Data;
using System.Configuration;
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.Collections;
using System.Collections.Specialized;
using System.Text;
using System.Runtime.InteropServices;

public partial class PcInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        WMI w;
        LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>操作系统</strong></font><br />";
        w = new WMI(WMIPath.Win32_OperatingSystem);
        for (int i = 0; i < w.Count; i++)
        {
            LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + w[i, "Caption"].ToString() + "<br />";
        }

 

       
        LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>时区</strong></font><br />";
        w = new WMI(WMIPath.Win32_TimeZone);
        for (int i = 0; i < w.Count; i++)
        {
            LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + w[i, "Caption"].ToString() + "<br />";
        }

             LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>主板BIOS</strong></font><br />";
        w = new WMI(WMIPath.Win32_BIOS);
        for (int i = 0; i < w.Count; i++)
        {
            LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + w[i, "Caption"].ToString() + "<br />";
        }


       
        LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>系统分区</strong></font><br />";
        w = new WMI(WMIPath.Win32_LogicalDisk);
        for (int i = 0; i < w.Count; i++)
        {
            LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + w[i, "Caption"].ToString() + "&nbsp;";
        }


               LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>虚拟内存</strong></font><br />";
        w = new WMI(WMIPath.Win32_PageFile);
        for (int i = 0; i < w.Count; i++)
        {
            LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + w[i, "Caption"].ToString() + "<br />";
        }

 

       
        LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>网卡及MAC地址</strong></font><br />";
        w = new WMI(WMIPath.Win32_NetworkAdapterConfiguration);
        for (int i = 0; i < w.Count; i++)
        {
            if ((bool)w[i, "IPEnabled"])
            {
                LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + "网卡名称:" + w[i, "Caption"].ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + "MAC地址:" + w[i, "MACAddress"].ToString() + "<br />";
            }
        }


       
        LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>键盘</strong></font><br />";
        w = new WMI(WMIPath.Win32_Keyboard);
        for (int i = 0; i < w.Count; i++)
        {
            LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + w[i, "Caption"].ToString() + "<br />";
        }


       
        LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>打印机</strong></font><br />";
        w = new WMI(WMIPath.Win32_Printer);
        for (int i = 0; i < w.Count; i++)
        {
            LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + w[i, "Caption"].ToString() + "<br />";
        }

 


       
        LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>Modem接口</strong></font><br />";
        w = new WMI(WMIPath.Win32_POTSModem);
        for (int i = 0; i < w.Count; i++)
        {
            LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + w[i, "Caption"].ToString() + "<br />";
        }

 


             LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>系统驱动</strong></font><br />";
        w = new WMI(WMIPath.Win32_SystemDriver);
        for (int i = 0; i < w.Count; i++)
        {
            LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + w[i, "Caption"].ToString() + "<br />";
        }


       
        LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>系统服务</strong></font><br />";
        w = new WMI(WMIPath.Win32_Service);
        for (int i = 0; i < w.Count; i++)
        {
            LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + w[i, "Caption"].ToString() + "<br />";
        }

 

       
        LabelInfo.Text = LabelInfo.Text + "<font size='2' color='blue'><strong>系统进程</strong></font><br />";
        w = new WMI(WMIPath.Win32_Process);
        for (int i = 0; i < w.Count; i++)
        {
            LabelInfo.Text = LabelInfo.Text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/menu_arrow.gif'>&nbsp;" + w[i, "Caption"].ToString() + "<br />";
        }


    }
}

 

 

转载于:https://www.cnblogs.com/jubi2008/archive/2008/09/11/1288863.html

注意:sqlserver2005,sql2008,sql2012以上版本都可以运行的哦 系统特点: 1、多种题型,支持简答题,并且简单题的评阅需要管理手工评阅,其他提醒由计算机自动评阅 2、加入了权限管理,系统分为三种用户,管理员、教师和学生,管理员可以设定教师有哪些权限 3、“在用户管理”这一模块中,还增加了一个“重置密码”的功能,如果用户忘记密码了,管理员则可以把用户的密码重置 4、系统的登陆只用了一个界面,不用单选按钮就可以实现三种用户的智能登陆,会自动根据身份跳转到相应的页面 5、另外还用了Cookie实现了记住用户名,方便用户的输入 6、学生登陆成功后,可以修改个人密码,查看考试记录,也可以选择考试 7、界面美观方面,不同的权限显示不同的界面内容 系统后台功能: 个人信息管理 修改密码 部门信息管理 部门管理 用户信息管理 用户管理 权限设置 试卷制定维护 试卷制定(随机出题、人工出题) 试卷维护 用户试卷管理 试卷评阅 用户成绩 试题类别管理 单选题维护 多选题维护 判断题维护 填空题维护 问答题 Database下为Sql数据库文件,在sqlserver2000的企业管理器中附加即可,数据库的连接用户名:sa 密码:198517 如果你的数据库不一样,只需要到web.config文件中修改即可 管理员登陆帐号:admin 密码:admin 教师用户登陆帐号:wangjianlin 密码:198517 测试学生帐号1: 200305030317 密码:123 测试学生帐号2: 200305030318 密码:123
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值