用户名:   密码:    忘记密码  注册
我推信息网 > 下载专区 > 正文

.net 探针下载

2010年6月23日
信息简介:服务器信息 nvcServer.Add("服务器名称",Server.MachineName); nvcServer.Add("服务器IP地本",Environment.Version.ToString());


服务器信息:附件下载 info.rar


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="Information" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>服务器信息</title><style type="text/css">
                        INPUT
                        {
                            font-size: 12px;
                        }
                        table
                        {
                            border-collapse: collapse;
                        }
                        td
                        {
                            height: 20px;
                            padding: 3px;
                        }
                        BODY
                        {
                            margin: 20px;
                            font-size:12px;
                        }
                        .header
                        {
                            font-weight: bold;
                            font-size:12px;
                            color: #ffffff;
                            background-color: #0C944C;
                            border-left: solid 1px #0C944C;
                            border-top: solid 1px #0C944C;
                            border-right: solid 1px #0C944C;
                        }
                        .TbBr1
                        {
                            border: solid 1px #0C944C;
                        }
                        .TbBr1 td
                        {
                            font-size: 12px;
                            border-left:solid 1px #0C944C;
                            border-bottom:solid 1px #0C944C;
                            border-right:solid 1px #0C944C;
                            white-space: normal;
                        }
                        .TdTitle
                        {
                            background-image: url(TD_back.gif);
                            font-weight: bold;
                            color: #ffffff;
                        }
                        .ContentBR
                        {
                            font-weight: bold;
                            text-align: right;
                        }
                        .input
                        {
                            width: 60px;
                        }
                    </style>
</head>
<body>
<form id="form1" runat="server">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="TbBr1">
<tr>
<td colspan="4" class="header">组件支持查询及执行效率查询</td>
</tr>
<tr>
<td width="20%">自定义组件查询</td>
<td width="30%">&nbsp;<asp:TextBox ID="newCom" runat="server" Wrap="False" BorderStyle="Solid"
BorderWidth="1px" MaxLength="50"></asp:TextBox>&nbsp;<asp:Button ID="OK1" runat="server"
Text="查询" BorderStyle="Solid" CausesValidation="False" OnClick="OK1_Click"></asp:Button>&nbsp;
<asp:Label ID="resultCom" runat="server"></asp:Label></td>
<td width="20%">加法循环测试<asp:RangeValidator ID="Val1" runat="server" ErrorMessage="错误的参数!"
Display="None" ControlToValidate="newExec" MaximumValue="1000000000" MinimumValue="1"></asp:RangeValidator>
</td>
<td width="30%">&nbsp;<asp:TextBox ID="newExec" runat="server" Wrap="False" BorderStyle="Solid"
BorderWidth="1px" MaxLength="10">10000000</asp:TextBox>
<asp:RequiredFieldValidator ID="Val3" runat="server" ControlToValidate="newExec"
Display="None" ErrorMessage="参数不能为空!"></asp:RequiredFieldValidator>&nbsp;<asp:Button
ID="OK2" runat="server" Text="测试" BorderStyle="Solid" OnClick="OK2_Click"></asp:Button>&nbsp;
<asp:Label ID="resultAdd" runat="server"></asp:Label> </td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="header">服务器信息</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="TbBr1"
id="ServerInfo" runat="server"></table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="header">组件支持信息</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="TbBr1"
id="ComInfo" runat="server"></table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="header">客户端信息</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="TbBr1"
id="ClientInfo" runat="server"></table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="header">数据信息</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="TbBr1"
id="DataInfo" runat="server"></table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" id="CopyRight" runat="server">&nbsp;</td>
</tr>
</table>
<asp:ValidationSummary ID="Val2" runat="server" ShowMessageBox="True" ShowSummary="False"
HeaderText="出错信息:"></asp:ValidationSummary>
</form>
</body>
</html>

using System;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class Information : System.Web.UI.Page
 {
  //protected HtmlTable ServerInfo,ComInfo,ClientInfo;
  //protected System.Web.UI.WebControls.TextBox newCom;
  //protected System.Web.UI.WebControls.Button OK1;
  //protected System.Web.UI.WebControls.Label resultCom;
  //protected System.Web.UI.WebControls.Label resultAdd;
  //protected System.Web.UI.WebControls.TextBox newExec;
  //protected System.Web.UI.WebControls.ValidationSummary Val2;
  //protected System.Web.UI.WebControls.Button OK2;
  //protected System.Web.UI.WebControls.RangeValidator Val1;
  //protected System.Web.UI.WebControls.RequiredFieldValidator Val3;
  //protected System.Web.UI.HtmlControls.HtmlTableCell CopyRight;
 
  private void Page_Load(object sender, System.EventArgs e)
  {
      // 在此处放置用户代码以初始化页面
      Response.Expires = 0;
      Response.CacheControl = "no-cache";
      NameValueCollection nvcServer=new NameValueCollection();
      NameValueCollection nvcCom=new NameValueCollection();
      NameValueCollection nvcClient=new NameValueCollection();
      NameValueCollection nvcData = new NameValueCollection();
      DateTime StartTime=DateTime.Now;
      //服务器信息
      nvcServer.Add("服务器名称",Server.MachineName);
      nvcServer.Add("服务器IP地址",Request.ServerVariables["LOCAL_ADDR"]);
      nvcServer.Add("服务器域名",Request.ServerVariables["SERVER_NAME"]);
      nvcServer.Add(".NET框架版本",Environment.Version.ToString());
      nvcServer.Add("服务器操作系统",Environment.OSVersion.ToString());
      nvcServer.Add("IIS环境",Request.ServerVariables["SERVER_SOFTWARE"]);
      nvcServer.Add("服务器端口",Request.ServerVariables["SERVER_PORT"]);
      nvcServer.Add("脚本超时设置",Server.ScriptTimeout.ToString());
      nvcServer.Add("服务器现在时间",DateTime.Now.ToString());
      nvcServer.Add("虚拟目录绝对路径",Request.ServerVariables["APPL_PHYSICAL_PATH"]);
      nvcServer.Add("执行文件绝对路进",Request.ServerVariables["PATH_TRANSLATED"]);
      nvcServer.Add("HTTPS支持",Request.ServerVariables["HTTPS"]);
      nvcServer.Add("SESSION总数",Session.Keys.Count.ToString());
      nvcServer.Add("APPLICATION总数",Application.Keys.Count.ToString());

      //由于内容太多,去掉不常用组件检测
      //组件支持情况
      if (checkObject("JMail.SmtpMail"))
      {
       nvcCom.Add("JMail邮件","√");
      }
      else 
      {
       nvcCom.Add("JMail邮件","×");
      }
      if (checkObject("Persits.MailSender"))
      {
          nvcCom.Add("Persits邮件", "√");
      }
      else
      {
          nvcCom.Add("Persits邮件", "×");
      }
      if (checkObject("Geocel.Mailer"))
      {
          nvcCom.Add("Geocel邮件", "√");
      }
      else
      {
          nvcCom.Add("Geocel邮件", "×");
      }
      if (checkObject("SmtpMail.SmtpMail.1"))
      {
          nvcCom.Add("SmtpMail邮件", "√");
      }
      else
      {
          nvcCom.Add("SmtpMail邮件", "×");
      }
      if (checkObject("Persits.Upload.1"))
      {
          nvcCom.Add("Persits上传", "√");
      }
      else
      {
          nvcCom.Add("Persits上传", "×");
      }
      if (checkObject("aspcn.Upload"))
      {
          nvcCom.Add("Paspcn上传", "√");
      }
      else
      {
          nvcCom.Add("Paspcn上传", "×");
      }
      if (checkObject("LyfUpload.UploadFile"))
      {
          nvcCom.Add("LyfUpload上传", "√");
      }
      else
      {
          nvcCom.Add("LyfUpload上传", "×");
      }
      if (checkObject("SoftArtisans.FileManager"))
      {
          nvcCom.Add("SoftArtisans文件管理", "√");
      }
      else
      {
          nvcCom.Add("SoftArtisans文件管理", "×");
      }
      if (checkObject("w3.upload"))
      {
          nvcCom.Add("w3上传", "√");
      }
      else
      {
          nvcCom.Add("w3上传", "×");
      }
      if (checkObject("W3Image.Image"))
      {
          nvcCom.Add("W3Image图像读写", "√");
      }
      else
      {
          nvcCom.Add("W3Image图像读写", "×");
      }
      if (checkObject("ADODB.Connection"))
      {
          nvcCom.Add("ADO数据连接", "√");
      }
      else
      {
          nvcCom.Add("ADO数据连接", "×");
      }
      if (checkObject("ADODB.RecordSet"))
      {
          nvcCom.Add("ADO数据集", "√");
      }
      else
      {
          nvcCom.Add("ADO数据集", "×");
      }
      if (checkObject("Scripting.FileSystemObject"))
      {
          nvcCom.Add("FSO", "√");
      }
      else
      {
          nvcCom.Add("FSO", "×");
      }
      if (checkObject("CDONTS.NewMail"))
      {
          nvcCom.Add("CDONTS邮件", "√");
      }
      else
      {
          nvcCom.Add("CDONTS邮件", "×");
      }

      //客户端信息
      nvcClient.Add("客户端IP地址",Request.ServerVariables["REMOTE_ADDR"]);
      HttpBrowserCapabilities HBC=Request.Browser;
      nvcClient.Add("客户端操作系统",HBC.Platform.ToString());
      nvcClient.Add("浏览器",HBC.Browser.ToString());
      nvcClient.Add("浏览器版本",HBC.Version.ToString());
      nvcClient.Add("VBS",HBC.VBScript.ToString());
      nvcClient.Add("JS",HBC.JavaScript.ToString());
      nvcClient.Add("ActiveX",HBC.ActiveXControls.ToString());
      nvcClient.Add("JavaApplets",HBC.JavaApplets.ToString());
      nvcClient.Add("语言",Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"]);
      nvcClient.Add("框架支持",HBC.Frames.ToString());
      nvcClient.Add("Cookie支持",HBC.Cookies.ToString());
      nvcClient.Add("DOM",HBC.MSDomVersion.ToString());

      //数据信息
      string DataStr = "~/App_data/";
      string FileStr = "~/upfiles/";
      string DirStr = "~/";
      float DataSize = GetDirectoryLength(Server.MapPath(DataStr));
      float FileSize = GetDirectoryLength(Server.MapPath(FileStr));
      float DirSize = GetDirectoryLength(Server.MapPath(DirStr));
      float Program = DirSize - DataSize - FileSize;

      nvcData.Add("数据库大小", StrLen(DataSize));
      nvcData.Add("上传的文件大小", StrLen(FileSize));
      nvcData.Add("程序大小", StrLen(Program));
      nvcData.Add("总大小", StrLen(DirSize));

      //写出数据
      writeOut(nvcServer,ServerInfo);
      writeOut(nvcCom,ComInfo);
      writeOut(nvcClient,ClientInfo);
      writeOut(nvcData, DataInfo);
      DateTime EndTime=DateTime.Now;
      CopyRight.InnerHtml="本页执行时间:"+((EndTime-StartTime).TotalSeconds).ToString()+"秒  ";
   }
  private void writeOut(NameValueCollection nvc,HtmlTable ht)
  {
      for (int i = 0; i < nvc.Count; )
      {
        HtmlTableRow tr = new HtmlTableRow();
        for (int j = 0; j < 2; j++)
        {
            HtmlTableCell td = new HtmlTableCell();
            td.InnerHtml = nvc.GetKey(i).ToString();
            td.Width = "20%";
            HtmlTableCell td1 = new HtmlTableCell();
            td1.InnerHtml = nvc[i].ToString();
            td1.Width = "30%";
            tr.Controls.Add(td);
            tr.Controls.Add(td1);
            i++;
        }
        ht.Controls.Add(tr);
      }
  }
  private bool checkObject(string obj)
  {
   try 
   {
    object meobj = Server.CreateObject(obj);
    return(true);
   }
   catch
   {
    return(false);
   }
  }
  //#region Web Form Designer generated code
  //override protected void OnInit(EventArgs e)
  //{
  // //
  // // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
  // //
  // InitializeComponent();
  // base.OnInit(e);
  //}
  
  ///// 
  ///// 设计器支持所需的方法 - 不要使用代码编辑器修改
  ///// 此方法的内容。
  ///// 
  //private void InitializeComponent()
  //{    
  // this.OK1.Click += new System.EventHandler(this.OK1_Click);
  // this.OK2.Click += new System.EventHandler(this.OK2_Click);
  // this.Load += new System.EventHandler(this.Page_Load);
  //}
  //#endregion
  public void OK1_Click(object sender, System.EventArgs e)
  {
   if(checkObject(newCom.Text))
   {
    resultCom.Text="√";
   }
   else
   {
    resultCom.Text="×";
   }
  }
  public void OK2_Click(object sender, System.EventArgs e)
  {
   try
   {
    int sum=0;
    int newData = Convert.ToInt32(newExec.Text.Trim());
    DateTime startTime=DateTime.Now;
    for (int i = 0; i < newData; i++)
    {
      sum += i;
    }
    DateTime endTime=DateTime.Now;
    resultAdd.Text=((endTime-startTime).TotalMilliseconds).ToString()+"毫秒";
   }
   catch
   {
    resultAdd.Text="执行错误!可能是参数无效!";
   }
  }
  private string StrLen(float Number)
  {
      string NumStr=Number.ToString()+"&nbsp;Byte";
      if (Number>1024)
      {
          Number=Number / 1024 ;
          NumStr = Number.ToString("F2") + "&nbsp;KB";
      }
      if(Number>1024)
      {
          Number=Number / 1024;
          NumStr = Number.ToString("F2") + "&nbsp;MB";
      }
      if(Number>1024)
      {
          Number=Number / 1024 / 1024 /1024 ;
          NumStr=Number.ToString("F2")+"&nbsp;GB";
      }
      return NumStr;
  }
  public static long GetDirectoryLength(string dirPath)
  {
      //判断给定的路径是否存在,如果不存在则退出
      if (!Directory.Exists(dirPath))
        return 0;
      long len = 0;
      //定义一个DirectoryInfo对象
      DirectoryInfo di = new DirectoryInfo(dirPath);
      //通过GetFiles方法,获取di目录中的所有文件的大小
      foreach (FileInfo fi in di.GetFiles())
      {
        len += fi.Length;
      }
      //获取di中所有的文件夹,并存到一个新的对象数组中,以进行递归
      DirectoryInfo[] dis = di.GetDirectories();
      if (dis.Length > 0)
      {
        for (int i = 0; i < dis.Length; i++)
        {
            len += GetDirectoryLength(dis[i].FullName);
        }
      }
      return len;
  }
}
(阅览次数:2659次)【关闭
上一条: jquery-1.4.2.js下载(正常排版的JS文档)
下一条: 科来网络分析系统 2010 下载
你认为此条信息得分为:
% % % % %
很好 一般 不行
验证字符:
网友昵称: (Ctrl+Enter)
发表评论:
以下评论只代表网友个人观点,不代表我单位观点
暂时为空!
网站首页 -  政策法规 -  联系我们 -  免责申明 -  时尚一族 -  友情链接 -  关于我们 -  设为首页 -  加入收藏
版权所有:我推信息网 关键字:我推信息网 wotui 我推荐 我推
域 名:www.wotui.net 联系QQ (08:30-22:00在线): 邮 箱:yahali@sina.com
中华人民共和国电信与信息服务业务经营许可证

 

 

 

 

公共信息安全网络监察

经营性网站备案信息

不良信息举报中心 中国文明网络传播