急求,asp.net怎么获取客户端的计算机名
Request.ServerVariables["REMOTE_ADDR"];
System.Net.Dns.Resolve(Page.Request.UserHostName).HostName;   
Page.Request.UserHostName.ToString();
这些就不要说了  获取到的全是ip

解决方案 »

  1.   

    服务端程序 一般除了开放的 cookie userdata ip等数据,其他的客户端信息你是没办法获取的。
      

  2.   

    Page.Server.ManchineName
    这个应该可以的
      

  3.   

    用API试试[DllImport("kernel32",EntryPoint="GetComputerNameA", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
       public static extern int GetComputerName(string lpBuffer, ref int nSize);
     
        [DllImport("kernel32", EntryPoint = "GetComputerName", ExactSpelling = false, SetLastError = true)]
        public static extern bool GetComputerName([MarshalAs(UnmanagedType.LPArray)] byte[] lpBuffer, [MarshalAs(UnmanagedType.LPArray)] Int32[] nSize); public static string gsFNC_GetComputerName()
    {
    string returnValue;
                byte[] str = new byte[255];
                Int32[] len = new Int32[1];
                len[0] = 200;
                GetComputerName(str, len);
                string ComputerName = System.Text.Encoding.ASCII.GetString(str);
                returnValue = ComputerName.Substring(0,ComputerName.IndexOf('\0'));
        return returnValue;
    }
      

  4.   

    如果你的脚本有权限可以用wscript获得计算机名不过这种情况很少