上一篇:按照指定大小,生成缩略图 >>
.net探针
以下代码主要使用了NameValueCollection来存储信息,用HtmlTable来显示信息.以方便扩展.你也可以用xml来存储要刺探的项目,这样更有利于扩充.
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;
namespace Addr.Admin
{
?///
?/// Bougie 的摘要说明。
?///
?public class Bougie : 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();
????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());
????//写出数据
????writeOut(nvcServer,ServerInfo);
????writeOut(nvcCom,ComInfo);
????writeOut(nvcClient,ClientInfo);
????DateTime EndTime=DateTime.Now;
???CopyRight.InnerHtml="本页执行时间:"+((EndTime-StartTime).TotalSeconds).ToString()+"秒 ";
???CopyRight.InnerHtml+="CopyRighy ©2004 - 2006 4renx.com .netBougie version 1.0
千山一鸟作品[luo@4renx.com]";
??}
??private void writeOut(NameValueCollection nvc,HtmlTable ht)
??{
???for(int i=0;i???{
????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
??private void OK1_Click(object sender, System.EventArgs e)
??{
???if(checkObject(newCom.Text))
???{
????resultCom.Text="√";
???}
???else
???{
????resultCom.Text="×";
???}
??}
??private 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????{
?????sum+=i;
????}
????DateTime endTime=DateTime.Now;
????resultAdd.Text=((endTime-startTime).TotalMilliseconds).ToString()+"毫秒";
???}
???catch
???{
????resultAdd.Text="执行错误!可能是参数无效!";
???}
??}
?}
}
?
??
??
??
??
??http://schemas.microsoft.com/intellisense/ie5">
??
??
?
?
??
???
????
????? 服务器信息
????
???
???
???
???
????
????? 组件支持信息
????
???
???
???
???
????
????? 客户端信息
????
???
???
???
???
????
????? 组件支持查询及执行效率查询
????
????
????? 自定义组件查询
?????
??????
?????
??????
?????
??????
????
????
????? 加法循环测试
???????
???????
?????
??????10000000
?????
??????
?????
??????
????
???
???
????
?????
????
???
???
??
?
?
下一篇:.net分布式事务例子 >>
相关文章:
- · 鼠标移动,改变datagrid颜色
- · .NET 三种 序列化方式
- · 关于日期转换的心得
- · net中交易处理的解决方案
- · 利用Jmail发送和接收邮件(C#)
- · Community中的程序配置
- · 常用的读写ini文件的类
- · 利用反射,实现动态调用winform窗体!!
- · 取得本机IP地址的方法两则
- · 反射应用之一:根据控件名、属性名进行取值和赋值
- · Whidbey 初体验之局部类型 ( partial 类型)
- · 结构和类
- · 关于微软的.NET Framework是一个半成品的言论!
- · ASP.NET实现用户在线检测的类源码
- · 在ASP.NET下实现数字和字符相混合的验证码
- · ASP.NET结合COM组件发送Email
- · 创建基于ASP.NET的SMTP邮件服务
- · 用ASP.NET和XML做的新闻系统
- · ASP.Net+XML打造留言薄
- · 创建ASP.NET监视服务器进程
- · 创建用于ASP.NET的分页程序控件
- · 设计ASP.NET新闻管理系统
- · asp.net 实现“九连环”小游戏
- · 将Word文档转化为HTML格式的文档
- · 保存美丽记忆 用ASP.NET创建网络相册
- · ASP.NET中利用Crystal Report创建图表
- · 几个很不错的.NET 相关的FAQ和例子代码的连接
- · net应用程序如何批上XP的外衣?
- · 用.net中的socket实现文件传输
- · .NET Framework 中多语言支持的实现
- · weblogin类--简介(一)
- · .Net中如何操作IIS
- · 在.NET中调用存储过程
- · 收集了一些小技巧的连接 (.NET)
- · 使用CodeDom来生成.cs文件
- · 一次重构导向设计模式的实践(.NET)
- · 在设计期跟踪代码 (.NET)
- · 编译自己的资源文件编辑器(reseditor.exe)
