标签:form asp orm csharp display inf nload str html
JS获取当前国家示例:
<script src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js"></script>
<script>
$(function () {
var name = remote_ip_info["country"];
document.getElementById("guojia").value = name;
})
</script>
<input style="display:none" id="guojia" name="country" value="" />
C#获取ip地址:
//获取当前IP
public string GetIp()
{
System.Net.WebClient client = new System.Net.WebClient();
client.Encoding = System.Text.Encoding.Default;
string reply = client.DownloadString("http://www.ip138.com/ip2city.asp");
int start = reply.IndexOf("[");
int end = reply.IndexOf("]");
return reply.Substring((start + 1), (end - start - 1));
}
标签:form asp orm csharp display inf nload str html
原文地址:http://www.cnblogs.com/lanke0/p/7509037.html