2011-06-03 79 views

回答

0

主机名:

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已经支持这个功能,比如:

http://www.ipgeo.com/api/

+0

抱歉:(失败...我是印度,但它显示美国....告诉我frend,如果你发现gud ... – 2011-06-03 13:35:35

+0

@Shankar是它使用PC的语言/国家,所以如果它设置为一个不同的国家,那么它失败。你最好的选择是通过知识产权来实现,但涉及到更多的工作。 – Fase 2011-06-03 13:41:23

0
using System.Globalization; 

string culture = CultureInfo.CurrentCulture.EnglishName; 
string country = culture.Substring(culture.IndexOf('(') 

+ 1,culture.LastIndexOf( ')') - culture.IndexOf( '(') -

Client Country in C#


Get Client Computer NameHow 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; 
+0

它在本地..不服务器端工作:(..帮助我亚尔...这是非常紧急... – 2011-06-07 05:33:57

+0

我真的没有任何进一步的viewsinon.Hope你可以解决它。@Shankar – Bastardo 2011-06-07 07:05:46