没有合适的资源?快使用搜索试试~ 我知道了~
c#中获取服务器IP
2星 需积分: 50 11 下载量 180 浏览量
2011-08-25
07:38:20
上传
评论
收藏 2KB TXT 举报
温馨提示
试读
2页
获取cpu序列号,硬盘ID,网卡MAC地址 privatevoidstring cpuInfo ="";//cpu序列号 ManagementClass cimobject =new ManagementClass("Win32_Processor"); ManagementObjectCollection moc =foreach(ManagementObject mo in= mo.Properties["ProcessorId"].Value.ToString(); Response.Write ("cpu序列号:"+//获取硬盘ID String HDid; ManagementClass cimobject1 =new ManagementClass("Win32_DiskDrive"); ManagementObjectCollection moc1 =foreach(ManagementObject mo in= (string)mo.Properties["Model""硬盘序列号:"+//获取网卡硬件地址 =new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc2 =foreach(ManagementObject mo inif((bool)mo["IPEnabled"] ==true"MAC address\t{0}"+mo["MacAddress"
资源推荐
资源详情
资源评论
c#中获取服务器IP,客户端IP以及其它
"Remote_Addr").ToString();
客户端主机名:
Request.ServerVariables.Get("Remote_Host").ToString();
客户端浏览器IE:
Request.Browser.Browser;
客户端浏览器 版本号:
Request.Browser.MajorVersion;
客户端操作系统:
Request.Browser.Platform;
服务器ip:
Request.ServerVariables.Get("Local_Addr").ToString();
服务器名:
Request.ServerVariables.Get("Server_Name"foreach(String o in Request.ServerVariables)+"="+Request.ServerVariables[o]+"<br>"
string stringMAC =""string stringIP =""=new ManagementClass ("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection MOC=foreach(ManagementObject MO inif ((bool)MO["IPEnabled"] ==true+= MO["MACAddress"].ToString(); //获取网卡的地址
string[] IPAddresses = (string[]) MO["IPAddress"]; //获取本地的IP地址
if(IPAddresses.Length >0= IPAddresses[0+"/"++//要引用到以下两个命名空间
usingusing//获取远程客户端的网卡物理地址(MAC)
publicstring GetMac(string IP) //para IP is the client's IPstring dirResults=""=new=new="nbtstat"=false=true="-A "+=false== proc.StandardOutput.ReadToEnd();
proc.WaitForExit();
dirResults=dirResults.Replace("\r","").Replace("\n","").Replace("\t",""=new Regex("Mac[ ]{0,}Address[ ]{0,}=[ ]{0,}(?<key>((.)*?))__MAC",RegexOptions.IgnoreCase|=reg.Match(dirResults+"__MAC"if
else=new Regex("Host not found",RegexOptions.IgnoreCase|=if
else//在页面上打印出客户端的网卡物理地址(MAC)
Response.Write(this.GetMac(Request.UserHostAddress.ToString()));
获取cpu序列号,硬盘ID,网卡MAC地址
privatevoidstring cpuInfo ="";//cpu序列号
ManagementClass cimobject =new ManagementClass("Win32_Processor");
"Remote_Addr").ToString();
客户端主机名:
Request.ServerVariables.Get("Remote_Host").ToString();
客户端浏览器IE:
Request.Browser.Browser;
客户端浏览器 版本号:
Request.Browser.MajorVersion;
客户端操作系统:
Request.Browser.Platform;
服务器ip:
Request.ServerVariables.Get("Local_Addr").ToString();
服务器名:
Request.ServerVariables.Get("Server_Name"foreach(String o in Request.ServerVariables)+"="+Request.ServerVariables[o]+"<br>"
string stringMAC =""string stringIP =""=new ManagementClass ("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection MOC=foreach(ManagementObject MO inif ((bool)MO["IPEnabled"] ==true+= MO["MACAddress"].ToString(); //获取网卡的地址
string[] IPAddresses = (string[]) MO["IPAddress"]; //获取本地的IP地址
if(IPAddresses.Length >0= IPAddresses[0+"/"++//要引用到以下两个命名空间
usingusing//获取远程客户端的网卡物理地址(MAC)
publicstring GetMac(string IP) //para IP is the client's IPstring dirResults=""=new=new="nbtstat"=false=true="-A "+=false== proc.StandardOutput.ReadToEnd();
proc.WaitForExit();
dirResults=dirResults.Replace("\r","").Replace("\n","").Replace("\t",""=new Regex("Mac[ ]{0,}Address[ ]{0,}=[ ]{0,}(?<key>((.)*?))__MAC",RegexOptions.IgnoreCase|=reg.Match(dirResults+"__MAC"if
else=new Regex("Host not found",RegexOptions.IgnoreCase|=if
else//在页面上打印出客户端的网卡物理地址(MAC)
Response.Write(this.GetMac(Request.UserHostAddress.ToString()));
获取cpu序列号,硬盘ID,网卡MAC地址
privatevoidstring cpuInfo ="";//cpu序列号
ManagementClass cimobject =new ManagementClass("Win32_Processor");
资源评论
- claireguoli2013-05-15兄弟,你这资源分,咋好意思要的啊,哎,上火!是一个txt文档,内容其他地方就有,浪费了分!这分数咋也给个小demo啊
wang11qing
- 粉丝: 9
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 1040g0cg310ravpiu6ibg5pg00tsipsln3ju2d0g 2
- 基于Python的SAR图像去噪CNN-NLM设计源码
- redhat6升级到redhat7,过程redhat6.x-> redhat6.10->rehat7.9 主版本最高版本
- 基于Django的流程引擎设计源码
- 基于Node.js的Express框架与MySQL的后台管理系统设计源码
- 基于Java的Flink流批一体数据处理快速集成开发框架设计源码
- FirstFilterOrderCompare
- Screenshot_2024-03-28-19-17-25-020_com.ss.android.lark.jpg
- 基于Java的车辆违章信息查询系统设计源码
- wqeAFSDADWDAESD
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功