获取客户端机器ID
主机名:
Request.ServerVariables["REMOTE_HOST"]
见http://www.w3schools.com/asp/coll_servervariables.asp
解决国家:
public static RegionInfo ResolveCountry()
{
CultureInfo culture = ResolveCulture();
if (culture != null)
return new RegionInfo(culture.LCID);
return null;
}
从http://madskristensen.net/post/Get-language-and-country-from-a-browser-in-ASPNET.aspx
它使用PC的设置语言/国家。
通过IP尝试一个例子:
http://dotnetguts.blogspot.com/2008/06/finding-country-from-visitors-ip-in.html
包括检查请求的IP对不会忽略IP位置的数据库。
你也可以使用一个服务的IP已经支持这个功能,比如:
using System.Globalization; string culture = CultureInfo.CurrentCulture.EnglishName; string country = culture.Substring(culture.IndexOf('(')
+ 1,culture.LastIndexOf( ')') - culture.IndexOf( '(') -
Get Client Computer Name, How to get the client machine name from a server
您将使用 “Request.ServerVariables” 得到大部分的 客户机的细节
// Try the following C# code System.Net.IPHostEntry host = new System.Net.IPHostEntry(); host = System.Net.Dns.GetHostByAddress(Request.ServerVariables["REMOTE_HOST"]); lbl.Text = host.HostName;
它在本地..不服务器端工作:(..帮助我亚尔...这是非常紧急... – 2011-06-07 05:33:57
我真的没有任何进一步的viewsinon.Hope你可以解决它。@Shankar – Bastardo 2011-06-07 07:05:46
抱歉:(失败...我是印度,但它显示美国....告诉我frend,如果你发现gud ... – 2011-06-03 13:35:35
@Shankar是它使用PC的语言/国家,所以如果它设置为一个不同的国家,那么它失败。你最好的选择是通过知识产权来实现,但涉及到更多的工作。 – Fase 2011-06-03 13:41:23