《拓文asp.net网站内容管理系统》官方演示站。
 设为首页  
 收藏本站
 作者:黄振安
 QQ:53854651
首 页 开源拓文.NET编程网站编程网页设计图形图像数据库软件工程留言本
    站内搜索:  
您现在的位置: 拓文网络 → .NET编程 → ASP.NET → ASP.NET 取得客户端信息[正文]

热 门 文 章

相 关 文 章
  • ASP.NET性能优化
  • 在.NET框架应用程序中发送电子邮件
  • .net打包自动安装数据库
  • asp.net开发wap必备:更好的匹配手机设备
  • 用ashx动态生成文件
  • windows 2003下asp.Net站点无法使用用户名+密码的方
  • ASP.NET中17种正则表达式
  • 提高ASP.Net应用程序性能的十大方法
  • 一个通过web.Mail发送邮件的类
  • 在DataGrid里面根据日期的不同显示new图标
  • ASP.NET 取得客户端信息
     
    [作者:不详    转贴自:不详    点击数:    更新时间:2006-3-2 15:36:59]

     

    using System.Collections.Specialized  

    int loop1, loop2;
       NameValueCollection coll;
     
       // Load ServerVariable collection into NameValueCollection object.
       coll=Request.ServerVariables;
       // Get names of all keys into a string array.
       String[] arr1 = coll.AllKeys;
       for (loop1 = 0; loop1 < arr1.Length; loop1++)
       {
        Response.Write("Key: " + arr1[loop1] + "<br>");
        String[] arr2=coll.GetValues(arr1[loop1]);
        for (loop2 = 0; loop2 < arr2.Length; loop2++)
        {
         Response.Write("Value " + loop2 + ": " + arr2[loop2] + "<br>");
        }
       }


    ====以下是一个取得IP和操作系统以及浏览器的例子=========

    private string getIp()
    {/*穿过代理服务器取远程用户真实IP地址:*/
    if(Request.ServerVariables["HTTP_VIA"]!=null)
    return Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
    else
    return Request.ServerVariables["REMOTE_ADDR"].ToString();
    }
    Label2.Text =getIp();
    HttpBrowserCapabilities bc = new HttpBrowserCapabilities();
    bc = Request.Browser;
    string xitong ="你的操作系统为";
    Label3.Text=xitong+bc.Platform + " 浏览器类型:" + bc.Type;


    首页 | 1 | 尾页  共 1 页
     
    winner 打印本页 关闭窗口

         文 章 评 论
    评论人 查看该文章的评论 发表时间
       笔 名* : 0 50分 60分 70分 80分 90分 100分
    评论内容 *: (最多1000字。当前字数:0)


    没有相关评论,欢迎您参与!

    - 关于本站 - 网站帮助 - 下载声明 - 友情连接 - 网站地图 -
    Copyright © 2005-2006 myTopWin.Com. All Rights Reserved . [桂ICP备06004496号]