如何获取客户来访信息,如:您的真实IP 是:222.94.16.11,操作系统:Windows 2000,浏 览 器:Internet Explorer 6.0 最好有源码。问题解决马上结贴.E_mail:[email protected]

解决方案 »

  1.   

    HttpBrowserCapabilities bc = Request.Browser;
    Response.Write("<p>浏览器属性:</p>");
    Response.Write("浏览器型号 = " + bc.Type + "<br>");
    Response.Write("浏览器名称 = " + bc.Browser + "<br>");
    Response.Write("浏览器版本 = " + bc.Version + "<br>");
    Response.Write("主版本号 = " + bc.MajorVersion + "<br>");
    Response.Write("从版本号 = " + bc.MinorVersion + "<br>");
    Response.Write("操作系统 = " + bc.Platform + "<br>");
    Response.Write("是否试用版 = " + bc.Beta + "<br>");
    Response.Write("Is Crawler = " + bc.Crawler + "<br>");
    Response.Write("Is AOL = " + bc.AOL + "<br>");
    Response.Write("16位机 = " + bc.Win16 + "<br>");
    Response.Write("32位机 = " + bc.Win32 + "<br>");
    Response.Write("支持Frame = " + bc.Frames + "<br>");
    Response.Write("支持Table = " + bc.Tables + "<br>");
    Response.Write("支持Cookies = " + bc.Cookies + "<br>");
    Response.Write("支持VB Script = " + bc.VBScript + "<br>");
    Response.Write("支持 JavaScript = " + bc.JavaScript + "<br>");
    Response.Write("支持 Java Applets = " + bc.JavaApplets + "<br>");
    Response.Write("支持 ActiveX Controls = " + bc.ActiveXControls + "<br>");
    Response.Write("电台CDF = " + bc.CDF + "<br>");
    Response.Write(Request.UserAgent);
    Response.Write ("<script language='javascript'>//读屏幕的大小screenWidth=screen.width;screenHeight=screen.height;</script>");
    //屏幕分辨率的高:Response.Write (window.screen.height);
    //屏幕分辨率的宽:"+ window.screen.width;
    //屏幕可用工作区高度:"+ window.screen.availHeight;
    //屏幕可用工作区宽度:"+ window.screen.availWidth
      

  2.   

    IP:Request.ServerVariables["REMOTE_HOST"].ToString();
      

  3.   

    // This program shows how to use the IPAddress class to obtain a server 
    // IP addressess and related information.using System;
    using System.Net;
    using System.Net.Sockets;
    using System.Text.RegularExpressions;namespace Mssc.Services.ConnectionManagement
    {  class TestIPAddress 
      {    /**
          * The IPAddresses method obtains the selected server IP address information.
          * It then displays the type of address family supported by the server and its 
          * IP address in standard and byte format.
          **/
        private static void IPAddresses(string server) 
        {
          try 
          {
            System.Text.ASCIIEncoding ASCII = new System.Text.ASCIIEncoding();
      
            // Get server related information.
            IPHostEntry heserver = Dns.Resolve(server);        // Loop on the AddressList
            foreach (IPAddress curAdd in heserver.AddressList) 
            {
              // Display the type of address family supported by the server. If the
              // server is IPv6-enabled this value is: InternNetworkV6. If the server
              // is also IPv4-enabled there will be an additional value of InterNetwork.
              Console.WriteLine("AddressFamily: " + curAdd.AddressFamily.ToString());
              
              // Display the ScopeId property in case of IPV6 addresses.
              if(curAdd.AddressFamily.ToString() == ProtocolFamily.InterNetworkV6.ToString())
                Console.WriteLine("Scope Id: " + curAdd.ScopeId.ToString());
              // Display the server IP address in the standard format. In 
              // IPv4 the format will be dotted-quad notation, in IPv6 it will be
              // in in colon-hexadecimal notation.
              Console.WriteLine("Address: " + curAdd.ToString());
            
              // Display the server IP address in byte format.
              Console.Write("AddressBytes: ");          Byte[] bytes = curAdd.GetAddressBytes();
              for (int i = 0; i < bytes.Length; i++) 
              {
                Console.Write(bytes[i]);
              }                                    Console.WriteLine("\r\n");        }      }
          catch (Exception e) 
          {
            Console.WriteLine("[DoResolve] Exception: " + e.ToString());
          }
        }
      

  4.   

    // This IPAddressAdditionalInfo displays additional server address information.
        private static void IPAddressAdditionalInfo() 
        {
          try 
          {
            // Display the flags that show if the server supports IPv4 or IPv6
            // address schemas.
            Console.WriteLine("\r\nSupportsIPv4: " + Socket.SupportsIPv4);
            Console.WriteLine("SupportsIPv6: " + Socket.SupportsIPv6);        if (Socket.SupportsIPv6)
            {
              // Display the server Any address. This IP address indicates that the server 
              // should listen for client activity on all network interfaces. 
              Console.WriteLine("\r\nIPv6Any: " + IPAddress.IPv6Any.ToString());          // Display the server loopback address. 
              Console.WriteLine("IPv6Loopback: " + IPAddress.IPv6Loopback.ToString());
          
              // Used during autoconfiguration first phase.
              Console.WriteLine("IPv6None: " + IPAddress.IPv6None.ToString());
          
              Console.WriteLine("IsLoopback(IPv6Loopback): " + IPAddress.IsLoopback(IPAddress.IPv6Loopback));
            }
            Console.WriteLine("IsLoopback(Loopback): " + IPAddress.IsLoopback(IPAddress.Loopback));
          }
          catch (Exception e) 
          {
            Console.WriteLine("[IPAddresses] Exception: " + e.ToString());
          }
        }
      

  5.   

    上面的几位:你们能获取到这样(IP 是:222.94.16.11,操作系统:Windows 2000,浏 览 器:Internet Explorer 6.0 
    )的信息吗?????????
      

  6.   

    自已把上面的语句拼一下不就行了:
    string ac="您的真实IP 是:"+Request.ServerVariables["REMOTE_HOST"].ToString()+",操作系统:"+bc.Platform +",浏 览 器:"+
    bc.Version +bc.MajorVersion +bc.MinorVersion ;
    Response.Write(ac);
      

  7.   

    to:ztwwh(爱你一万年)  你的东西能得到像windows2000这样的东西吗?这些东西我在发帖子之前我就会呢@
      

  8.   

    HttpBrowserCapabilities bc = Request.Browser;
     Response.Write("<p>Browser Capabilities:</p>");
     Response.Write("Type = " + bc.Type + "<br>");
     Response.Write("Name = " + bc.Browser + "<br>");
     Response.Write("Version = " + bc.Version + "<br>");
     Response.Write("Major Version = " + bc.MajorVersion + "<br>");
     Response.Write("Minor Version = " + bc.MinorVersion + "<br>");
     Response.Write("Platform = " + bc.Platform + "<br>");
     Response.Write("Is Beta = " + bc.Beta + "<br>");
     Response.Write("Is Crawler = " + bc.Crawler + "<br>");
     Response.Write("Is AOL = " + bc.AOL + "<br>");
     Response.Write("Is Win16 = " + bc.Win16 + "<br>");
     Response.Write("Is Win32 = " + bc.Win32 + "<br>");
     Response.Write("Supports Frames = " + bc.Frames + "<br>");
     Response.Write("Supports Tables = " + bc.Tables + "<br>");
     Response.Write("Supports Cookies = " + bc.Cookies + "<br>");
     Response.Write("Supports VB Script = " + bc.VBScript + "<br>");
     Response.Write("Supports JavaScript = " + bc.JavaScript + "<br>");
     Response.Write("Supports Java Applets = " + bc.JavaApplets + "<br>");
     Response.Write("Supports ActiveX Controls = " + bc.ActiveXControls + "<br>");
     Response.Write("CDF = " + bc.CDF + "<br>");
      

  9.   

    // This IPAddressAdditionalInfo displays additional server address information.
        private static void IPAddressAdditionalInfo() 
        {
          try 
          {
            // Display the flags that show if the server supports IPv4 or IPv6
            // address schemas.
            Console.WriteLine("\r\nSupportsIPv4: " + Socket.SupportsIPv4);
            Console.WriteLine("SupportsIPv6: " + Socket.SupportsIPv6);        if (Socket.SupportsIPv6)
            {
              // Display the server Any address. This IP address indicates that the server 
              // should listen for client activity on all network interfaces. 
              Console.WriteLine("\r\nIPv6Any: " + IPAddress.IPv6Any.ToString());          // Display the server loopback address. 
              Console.WriteLine("IPv6Loopback: " + IPAddress.IPv6Loopback.ToString());
          
              // Used during autoconfiguration first phase.
              Console.WriteLine("IPv6None: " + IPAddress.IPv6None.ToString());
          
              Console.WriteLine("IsLoopback(IPv6Loopback): " + IPAddress.IsLoopback(IPAddress.IPv6Loopback));
            }
            Console.WriteLine("IsLoopback(Loopback): " + IPAddress.IsLoopback(IPAddress.Loopback));
          }
          catch (Exception e) 
          {
            Console.WriteLine("[IPAddresses] Exception: " + e.ToString());
          }
        }
    // This IPAddressAdditionalInfo displays additional server address information.
        private static void IPAddressAdditionalInfo() 
        {
          try 
          {
            // Display the flags that show if the server supports IPv4 or IPv6
            // address schemas.
            Console.WriteLine("\r\nSupportsIPv4: " + Socket.SupportsIPv4);
            Console.WriteLine("SupportsIPv6: " + Socket.SupportsIPv6);        if (Socket.SupportsIPv6)
            {
              // Display the server Any address. This IP address indicates that the server 
              // should listen for client activity on all network interfaces. 
              Console.WriteLine("\r\nIPv6Any: " + IPAddress.IPv6Any.ToString());          // Display the server loopback address. 
              Console.WriteLine("IPv6Loopback: " + IPAddress.IPv6Loopback.ToString());
          
              // Used during autoconfiguration first phase.
              Console.WriteLine("IPv6None: " + IPAddress.IPv6None.ToString());
          
              Console.WriteLine("IsLoopback(IPv6Loopback): " + IPAddress.IsLoopback(IPAddress.IPv6Loopback));
            }
            Console.WriteLine("IsLoopback(Loopback): " + IPAddress.IsLoopback(IPAddress.Loopback));
          }
          catch (Exception e) 
          {
            Console.WriteLine("[IPAddresses] Exception: " + e.ToString());
          }
        }
    // This IPAddressAdditionalInfo displays additional server address information.
        private static void IPAddressAdditionalInfo() 
        {
          try 
          {
            // Display the flags that show if the server supports IPv4 or IPv6
            // address schemas.
            Console.WriteLine("\r\nSupportsIPv4: " + Socket.SupportsIPv4);
            Console.WriteLine("SupportsIPv6: " + Socket.SupportsIPv6);        if (Socket.SupportsIPv6)
            {
              // Display the server Any address. This IP address indicates that the server 
              // should listen for client activity on all network interfaces. 
              Console.WriteLine("\r\nIPv6Any: " + IPAddress.IPv6Any.ToString());          // Display the server loopback address. 
              Console.WriteLine("IPv6Loopback: " + IPAddress.IPv6Loopback.ToString());
          
              // Used during autoconfiguration first phase.
              Console.WriteLine("IPv6None: " + IPAddress.IPv6None.ToString());
          
              Console.WriteLine("IsLoopback(IPv6Loopback): " + IPAddress.IsLoopback(IPAddress.IPv6Loopback));
            }
            Console.WriteLine("IsLoopback(Loopback): " + IPAddress.IsLoopback(IPAddress.Loopback));
          }
          catch (Exception e) 
          {
            Console.WriteLine("[IPAddresses] Exception: " + e.ToString());
          }
        }
    // This IPAddressAdditionalInfo displays additional server address information.
        private static void IPAddressAdditionalInfo() 
        {
          try 
          {
            // Display the flags that show if the server supports IPv4 or IPv6
            // address schemas.
            Console.WriteLine("\r\nSupportsIPv4: " + Socket.SupportsIPv4);
            Console.WriteLine("SupportsIPv6: " + Socket.SupportsIPv6);        if (Socket.SupportsIPv6)
            {
              // Display the server Any address. This IP address indicates that the server 
              // should listen for client activity on all network interfaces. 
              Console.WriteLine("\r\nIPv6Any: " + IPAddress.IPv6Any.ToString());          // Display the server loopback address. 
              Console.WriteLine("IPv6Loopback: " + IPAddress.IPv6Loopback.ToString());
          
              // Used during autoconfiguration first phase.
              Console.WriteLine("IPv6None: " + IPAddress.IPv6None.ToString());
          
              Console.WriteLine("IsLoopback(IPv6Loopback): " + IPAddress.IsLoopback(IPAddress.IPv6Loopback));
            }
            Console.WriteLine("IsLoopback(Loopback): " + IPAddress.IsLoopback(IPAddress.Loopback));
          }
          catch (Exception e) 
          {
            Console.WriteLine("[IPAddresses] Exception: " + e.ToString());
          }
        }
      

  10.   

    http://dotnet.aspx.cc/ShowDetail.aspx?id=HLFQ4ZOY-N3GO-4R7Y-WY5R-XZZN2JY5J8HZ
      

  11.   

    获得客户端IP地址:
    String ClientIP;
     ClientIP = Request.UserHostAddress;获得浏览器相关信息:
    HttpBrowserCapabilities bc = Request.Browser;
     Response.Write("<p>Browser Capabilities:</p>");
     Response.Write("Type = " + bc.Type + "<br>");
     Response.Write("Name = " + bc.Browser + "<br>");
     Response.Write("Version = " + bc.Version + "<br>");
     Response.Write("Major Version = " + bc.MajorVersion + "<br>");
     Response.Write("Minor Version = " + bc.MinorVersion + "<br>");
     Response.Write("Platform = " + bc.Platform + "<br>");
     Response.Write("Is Beta = " + bc.Beta + "<br>");
     Response.Write("Is Crawler = " + bc.Crawler + "<br>");
     Response.Write("Is AOL = " + bc.AOL + "<br>");
     Response.Write("Is Win16 = " + bc.Win16 + "<br>");
     Response.Write("Is Win32 = " + bc.Win32 + "<br>");
     Response.Write("Supports Frames = " + bc.Frames + "<br>");
     Response.Write("Supports Tables = " + bc.Tables + "<br>");
     Response.Write("Supports Cookies = " + bc.Cookies + "<br>");
     Response.Write("Supports VB Script = " + bc.VBScript + "<br>");
     Response.Write("Supports JavaScript = " + bc.JavaScript + "<br>");
     Response.Write("Supports Java Applets = " + bc.JavaApplets + "<br>");
     Response.Write("Supports ActiveX Controls = " + bc.ActiveXControls + "<br>");
     Response.Write("CDF = " + bc.CDF + "<br>");详细请参见
    ms-help://MS.NETFrameworkSDKv1.1.CHS/cpref/html/frlrfsystemwebhttprequestmemberstopic.htm
      

  12.   

    我的机器是2003,返回的是Winnt。楼主是这个意思吧?
      

  13.   

    我不是这个意思,这个我会,
    如果操作系统是windows2000就返回:windwos2000,如果是windows2003就返回windows2003.
      

  14.   

    我不是这个意思,这个我会,
    如果操作系统是windows2000就返回:windwos2000,如果是windows2003就返回windows2003.
      

  15.   

    都返回的是winnt,不知怎么弄,学习。
      

  16.   

    我不是这个意思,这个我会,
    如果操作系统是windows2000就返回:windwos2000,如果是windows2003就返回windows2003.
      

  17.   

    我在同一台Win2K机器上访问不同的IIS网站,一个返回Win2000,另一个返回WinNT
    仅仅根据 Request.Browser.Platform 可能还不足于确定 OS 的实际版本Request.Browser.Platform 返回值:
        Win2000 => Win 2K
        WinNT    => Win NT / Win 2K / Win XP
        Win98   => Win 98
        Win95   => Win 95Request.Browser.Version 返回值:
        IE 5.0 => Internet Explorer 5.0
        IE 6.0 => Internet Explorer 6.0
      

  18.   

    用for each循环一下Request.ServerVariables字典中的索引和值,所有可以从HTTP获取的信息都在里面了。另外.NET还自动分离该信息组合HttpBrowserCapabilities对象,你可以从该对象获取。
      

  19.   

    os=GetOs(Request.UserAgent);
    browser=GetBrowser(Request.UserAgent);
    ip=这个就不用写了吧!;)public static string GetOs(string useragent)
    {
    if(useragent.IndexOf("Windows 2003")>-1 || useragent.IndexOf("NT 5.2")>-1)
    return "Windows 2003";
    else if(useragent.IndexOf("Windows XP")>-1 || useragent.IndexOf("NT 5.1")>-1)
    return "Windows XP";
    else if(useragent.IndexOf("Windows 2000")>-1 || useragent.IndexOf("NT 5")>-1)
    return "Windows 2000";
    else if(useragent.IndexOf("Windows NT")>-1 || useragent.IndexOf("WinNT")>-1)
    return "Windows  NT 4";
    else if(useragent.IndexOf("Windows 95")>-1 || useragent.IndexOf("Win95")>-1)
    return "Windows 95";
    else if(useragent.IndexOf("Windows ME")>-1 || useragent.IndexOf("Win 9x 4.90")>-1)
    return "Windows ME";
    else if(useragent.IndexOf("Windows 98")>-1 || useragent.IndexOf("Win98")>-1)
    return "Windows 98";
    else if(useragent.IndexOf("Windows CE")>-1)
    return "Windows CE"; else if(useragent.IndexOf("PalmOS")>-1)
    return "PalmOS";
    else if(useragent.IndexOf("Linux")>-1)
    return "Linux";
    else if(useragent.IndexOf("Solaris")>-1)
    return "Solaris";
    else if(useragent.IndexOf("SunOS")>-1)
    return "SunOS";
    else if(useragent.IndexOf("BSD")>-1)
    return "Free BSD";
    else if(useragent.IndexOf("Unix")>-1)
    return "Unix";
    else if(useragent.IndexOf("Mac OS X")>-1)
    return "Mac OS X";
    else if(useragent.IndexOf("Mac_PowerPC")>-1)
    return "Mac_PowerPC";
    else if(useragent.IndexOf("6800")>-1)
    return "Mac 68k";
    else if(useragent.IndexOf("Mac")>-1)
    return "Macintosh";
    else if(useragent.IndexOf("OS/2")>-1)
    return "OS/2";
    else
    return "Unknown"; }
    public static string GetBrowser(string useragent)
    {
    if(useragent.IndexOf("MyIE2")>-1)
    return "MyIE2";
    else if(useragent.IndexOf("NetCaptor")>-1)
    return "NetCaptor";
    else if(useragent.IndexOf("MSIE 7")>-1)
    return "Microsoft IE 7";
    else if(useragent.IndexOf("MSIE 6")>-1)
    return "Microsoft IE 6";
    else if(useragent.IndexOf("MSIE 5")>-1)
    return "Microsoft IE 5";
    else if(useragent.IndexOf("Opera")>-1)
    return "Opera";
    else if(useragent.IndexOf("MSIE 4")>-1)
    return "Microsoft IE 4";
    else if(useragent.IndexOf("MSIE")>-1)
    return "Microsoft IE";
    else if(useragent.IndexOf("Netscape/8")>-1)
    return "Netscape8";
    else if(useragent.IndexOf("Netscape/7")>-1)
    return "Netscape7";
    else if(useragent.IndexOf("Netscape6")>-1)
    return "Netscape6";
    else if(useragent.IndexOf("Mozilla/4")>-1)
    return "Netscape4";
    else if(useragent.IndexOf("Mozilla/3")>-1)
    return "Netscape3";
    else if(useragent.IndexOf("Mozilla/2")>-1)
    return "Netscape2";
    else if(useragent.IndexOf("Mozilla/1")>-1)
    return "Netscape1";
    else if(useragent.IndexOf("AOL")>-1)
    return "AOL";
    else if(useragent.IndexOf("Sun")>-1)
    return "HotJava";
    else
    return "Unknown"; }
      

  20.   

    操作系统考版本号来判断的,比如winnt5.1是winxp,5.2是win2003
      

  21.   

    FENGUFO(阿茂)所述
    useragent指什么?
      

  22.   

    如果对方使用代理服务器就不行了,读取得是代理的ip,我记得在asp里有个读取的是真实的ip地址
      

  23.   

    string ac="您的真实IP 是:"+Request.ServerVariables["REMOTE_HOST"].ToString()+",操作系统:"+bc.Platform +",浏 览 器:"+
    bc.Version +bc.MajorVersion +bc.MinorVersion ;
    Response.Write(ac);
      

  24.   

    lx1116(阿牛):
    你有没有发个例子给
    [email protected]