我是这么想的, 判断( 客户机的IP 不是127.0.0.1 && 该IP不是与服务器的IP相同 )
   该主机不是该服务器;如何获取服务器的IP呢?有没有更好的方法, 我这可能要判断两次,有没有只判断一次的方法?

解决方案 »

  1.   

    服务器的IP
    Request.ServerVariables.Get("Local_Addr").ToString();
      

  2.   

    sorry,上面的可能只得到127.0.0.1,下面的才是你说的private static string getIPAddress ( ) 

    System.Net.IPAddress addr=null; 
    string address=null;
    System.Net.Dns.GetHostName ( ) ; 
    for(int i=0;i<System.Net.Dns.GetHostByName( System.Net.Dns.GetHostName ( ) ) .AddressList.Length; i++)
    {
    addr = new System.Net.IPAddress ( System.Net.Dns.GetHostByName( System.Net.Dns.GetHostName ( ) ) .AddressList [i].Address ) ; 
    address=address+addr;
    }
    return   address ; 
    }