搞很久没有搞出来
大家帮忙解决一下了

解决方案 »

  1.   

    Request.ServerVariables["REMOTE_ADDR"]
      

  2.   

    获取Client端的机器IP地址:
    Response.Write(Request.UserHostAddress);
      

  3.   

    string user_IP="";
    if(Request.ServerVariables["HTTP_VIA"]!=null){ 
    user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); 
    }else{ 
    user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); 

      

  4.   

    string strIP=Request.UserHostAddress;
      

  5.   

    HttpRequest request = System.Web.HttpContext.Current.Request;
    if(!request.Url.IsDefaultPort)
    {
    return request.Url.Host+":"+request.Url.Port.ToString();
    }
    return request.Url.Host;