ASP.NET追捕休整版
2007-12-15 09:32:45 来源:WEB开发网核心提示: C#第一个正式应用,ASP.NET追捕休整版! 这个程序,是前天我买到Visual Studio.net beta 2 中文版后编写的第一个正式程序,感觉只真是好极了!! 这个追捕的代码参考过飞刀的ASP.NET 追捕的文章,但他文章中是针对.NET 框架beta1的,而BETA2中好多的地方都修改调整了,顺
C#第一个正式应用,ASP.NET追捕休整版!
这个程序,是前天我买到Visual Studio.net beta 2 中文版后编写的第一个正式程序,感觉只真是好极了!!
这个追捕的代码参考过飞刀的ASP.NET 追捕的文章,但他文章中是针对.NET 框架beta1的,而BETA2中好多的地方都修改调整了,顺便也给程序增加了列表IP的功能,也就是说主机的多个IP地址都可以列出来的.只是那个根据IP查到IP所在地的功能暂时没做,因为当时我用的机器是朋友的,而手头没有IP数据库:~(
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
string Localhost = System.Net.Dns.GetHostName();
int i = 0;
int n = Dns.Resolve(Localhost.ToString()).AddressList.GetLength(0);
lblIpInfo.Text = Localhost.ToString()+",就是你啊!";
txtHostname.Text = Dns.Resolve(Localhost.ToString()).AddressList.GetValue(0).ToString();
lblSystem.Text = "待命中...";
lblHttp.Text = "待命中...";
lblFtp.Text = "待命中...";
lblDns.Text = "待命中...";
lblTelnet.Text = "待命中...";
lblSmtp.Text = "待命中...";
lblPop.Text = "待命中...";
for(;i<n;i++)
{
IPListbox.Items.Add(Dns.Resolve(Localhost.ToString()).AddressList.GetValue(i).ToString());
}
}
private void cmdExec_Click(object sender, System.EventArgs e)
{
IPAddress theIP;
txtHostname.Focus();
if(txtHostname.Text.Length==0)
{
MessageBox.Show("您可以输入要追捕的IP或者主机名称!但不能为空","系统提示");
return; //false
}
try
{
int i = 0;
int n = Dns.Resolve(txtHostname.Text.ToString()).AddressList.GetLength(0);
IPListbox.Items.Clear();
for(;i<n;i++)
{
IPListbox.Items.Add(Dns.Resolve(txtHostname.Text.ToString()).AddressList.GetValue(i).ToString());
}
theIP = (IPAddress)Dns.Resolve(txtHostname.Text.ToString()).AddressList.GetValue(0);
lblIpInfo.Text = theIP.ToString();
if(check1.Checked==true)
{//
lblSystem.Text = "检测中...";
lblHttp.Text = "检测中...";
lblFtp.Text = "检测中...";
lblDns.Text = "检测中...";
lblTelnet.Text = "检测中...";
lblSmtp.Text = "检测中...";
lblPop.Text = "检测中...";
//检查服务
DetectService(theIP);
DetectPort(theIP);
lblSystem.Text = strSystem.ToString();
lblHttp.Text = strHttp.ToString();
lblFtp.Text = strFtp.ToString();
lblDns.Text = strDns.ToString();
lblTelnet.Text = strTelnet.ToString();
lblSmtp.Text = strSmtp.ToString();
lblPop.Text = strPop.ToString();
}
if(check2.Checked==true)
{
//查IP 所在地区,未实现
}
}
catch
{
MessageBox.Show("这个主机无法连接哦!\r\n请重新输入一个正确的吧!","系统提示");
txtHostname.Text = "";
txtHostname.Focus();
lblIpInfo.Text = "无法连接或转换IP,所在地大概是外星球!";
lblSystem.Text = "待命中...";
lblHttp.Text = "待命中...";
lblFtp.Text = "待命中...";
这个程序,是前天我买到Visual Studio.net beta 2 中文版后编写的第一个正式程序,感觉只真是好极了!!
这个追捕的代码参考过飞刀的ASP.NET 追捕的文章,但他文章中是针对.NET 框架beta1的,而BETA2中好多的地方都修改调整了,顺便也给程序增加了列表IP的功能,也就是说主机的多个IP地址都可以列出来的.只是那个根据IP查到IP所在地的功能暂时没做,因为当时我用的机器是朋友的,而手头没有IP数据库:~(
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
string Localhost = System.Net.Dns.GetHostName();
int i = 0;
int n = Dns.Resolve(Localhost.ToString()).AddressList.GetLength(0);
lblIpInfo.Text = Localhost.ToString()+",就是你啊!";
txtHostname.Text = Dns.Resolve(Localhost.ToString()).AddressList.GetValue(0).ToString();
lblSystem.Text = "待命中...";
lblHttp.Text = "待命中...";
lblFtp.Text = "待命中...";
lblDns.Text = "待命中...";
lblTelnet.Text = "待命中...";
lblSmtp.Text = "待命中...";
lblPop.Text = "待命中...";
for(;i<n;i++)
{
IPListbox.Items.Add(Dns.Resolve(Localhost.ToString()).AddressList.GetValue(i).ToString());
}
}
private void cmdExec_Click(object sender, System.EventArgs e)
{
IPAddress theIP;
txtHostname.Focus();
if(txtHostname.Text.Length==0)
{
MessageBox.Show("您可以输入要追捕的IP或者主机名称!但不能为空","系统提示");
return; //false
}
try
{
int i = 0;
int n = Dns.Resolve(txtHostname.Text.ToString()).AddressList.GetLength(0);
IPListbox.Items.Clear();
for(;i<n;i++)
{
IPListbox.Items.Add(Dns.Resolve(txtHostname.Text.ToString()).AddressList.GetValue(i).ToString());
}
theIP = (IPAddress)Dns.Resolve(txtHostname.Text.ToString()).AddressList.GetValue(0);
lblIpInfo.Text = theIP.ToString();
if(check1.Checked==true)
{//
lblSystem.Text = "检测中...";
lblHttp.Text = "检测中...";
lblFtp.Text = "检测中...";
lblDns.Text = "检测中...";
lblTelnet.Text = "检测中...";
lblSmtp.Text = "检测中...";
lblPop.Text = "检测中...";
//检查服务
DetectService(theIP);
DetectPort(theIP);
lblSystem.Text = strSystem.ToString();
lblHttp.Text = strHttp.ToString();
lblFtp.Text = strFtp.ToString();
lblDns.Text = strDns.ToString();
lblTelnet.Text = strTelnet.ToString();
lblSmtp.Text = strSmtp.ToString();
lblPop.Text = strPop.ToString();
}
if(check2.Checked==true)
{
//查IP 所在地区,未实现
}
}
catch
{
MessageBox.Show("这个主机无法连接哦!\r\n请重新输入一个正确的吧!","系统提示");
txtHostname.Text = "";
txtHostname.Focus();
lblIpInfo.Text = "无法连接或转换IP,所在地大概是外星球!";
lblSystem.Text = "待命中...";
lblHttp.Text = "待命中...";
lblFtp.Text = "待命中...";
- ››asp.net页面弄成伪静态页面
- ››Asp.net 中将汉字转换成拼音的方法
- ››ASP.NET及JS中的cookie基本用法
- ››ASP.NET获取MS SQL Server安装实例
- ››asp.net实现调用百度pai 在线翻译英文转中文
- ››ASP.NET页面选项进行提示判断
- ››Asp.net定时执行程序
- ››ASP.NET中利用DataList实现图片无缝滚动
- ››ASP.NET验证控件RequiredFieldValidator
- ››ASP.NET中使用System.Net.Mail发邮件
- ››ASP.NET中获取用户控件中控件的ID
- ››ASP.NET中FileBytes写成文件并存档
更多精彩
赞助商链接