欢迎访问 生活随笔!

凯发k8官方网

当前位置: 凯发k8官方网 > 编程语言 > asp.net >内容正文

asp.net

asp.net获取客户端、服务器端基础信息集合 -凯发k8官方网

发布时间:2024/10/8 asp.net 0 豆豆
凯发k8官方网 收集整理的这篇文章主要介绍了 asp.net获取客户端、服务器端基础信息集合 小编觉得挺不错的,现在分享给大家,帮大家做个参考.
1. 在asp.net中专用属性:
获取服务器电脑名:page.server.manchinename
获取用户信息:page.user
获取客户端电脑名:page.request.userhostname
获取客户端电脑ip:page.request.userhostaddress
2. 在网络编程中的通用方法:
获取当前电脑名:static system.net.dns.gethostname()
根据电脑名取出全部ip地址:static system.net.dns.resolve(电脑名).addresslist
也可根据ip地址取出电脑名:static system.net.dns.resolve(ip地址).hostname
3. 系统环境类的通用属性:
当前电脑名:static system.environment.machinename
当前电脑所属网域:static system.environment.userdomainname
当前电脑用户:static system.environment.username

客户端ip:page.request.userhostaddress;
用户信息:page.user;
服务器电脑名称:page.server.machinename;
当前用户电脑名称:system.net.dns.gethostname();
当前电脑名:system.environment.machinename;
当前电脑所属网域:system.environment.userdomainname;
当前电脑用户:system.environment.username;
浏览器类型:request.browser.browser;
浏览器标识:request.browser.id;
浏览器版本号:request.browser.version;
浏览器是不是测试版本:request.browser.beta;
浏览器的分辨率(像素):request["width"].tostring() "*" request["height"].tostring();//1280*1024
客户端的操作系统:request.browser.platform;
是不是win16系统:request.browser.win16;
是不是win32系统:request.browser.win32;

4.服务器端的信息:
服务器计算机名:"http://" httpcontext.current.request.url.host httpcontext.current.request.applicationpath;
服务器iis版本: request.servervariables["server_software"].tostring();
服务器域名:request.servervariables["server_name"].tostring();
服务器端口:request.servervariables["server_port"].tostring();
服务器ip地址:request.servervariables["local_addr"]
服务器脚本超时时间:(server.scripttimeout / 1000).tostring() "秒";
服务器操作系统:environment.osversion.tostring();
本文件所在文件夹:request.physicalapplicationpath;
服务器ie版本:registry.localmachine.opensubkey(@"software/microsoft/internet explorer/version vector").getvalue("ie", "未检测到").tostring();
系统所在文件夹:environment.systemdirectory.tostring();
服务器当前时间: datetime.now.tostring();
服务器的语言种类:cultureinfo.installeduiculture.englishname;
服务器上次启动到现在已运行时间: ((environment.tickcount / 0x3e8) / 60).tostring() "分钟";
cpu 类型:environment.getenvironmentvariable("processor_identifier").tostring();
逻辑驱动器:string[] achdrives = directory.getlogicaldrives();
for (int i = 0; i < directory.getlogicaldrives().length - 1; i )
{
   achdrives.tostring();
}
cpu 总数:environment.getenvironmentvariable("number_of_processors").tostring();
虚拟内存:(environment.workingset / 1024).tostring() "m";
.net framework 版本:string.concat(new object[] { environment.version.major, ".", environment.version.minor, environment.version.build, ".", environment.version.revision });
asp.net所占cpu:((timespan)process.getcurrentprocess().totalprocessortime).totalseconds.tostring("n0");
asp.net所占内存: ((double)process.getcurrentprocess().workingset64 / 1048576).tostring("n2") "m";
当前session数量:session.contents.count.tostring();
当前程序占用内存:((double)gc.gettotalmemory(false) / 1048576).tostring("n2") "m";
当前sessionid:session.contents.sessionid;
当前系统用户名:environment.username;

转载于:https://www.cnblogs.com/kingboy2008/archive/2012/02/08/2857508.html

总结

以上是凯发k8官方网为你收集整理的asp.net获取客户端、服务器端基础信息集合的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得凯发k8官方网网站内容还不错,欢迎将凯发k8官方网推荐给好友。

网站地图