protected void Page_Load(object sender, EventArgs e)
{
string ipAddress = Request.UserHostAddress;
string url = "http://www.ip138.com/ips138.asp?ip="+ipAddress+"&action=2";
string pagecode = getPageCode(url, Encoding.GetEncoding("gb2312"));//getPageCode方法获取页面源码
string str = "^.*
参考数据一:(?.+?).*$";//正则表达式
Regex rgClass = new Regex(str, RegexOptions.Singleline);
Match match = rgClass.Match(pagecode);
string a = match.Groups["content"].Value;
Response.Write(a);
}
getPageCode方法在上一个博客里。