staticstringGetIP()
{
Uriuri=newUri(" http://www.ikaka.com/ip/index.asp";);
System.Net.HttpWebRequestreq=(System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
req.Method="POST";
req.ContentType="application/x-www-form-urlencoded";
req.ContentLength=0;
req.CookieContainer=newSystem.Net.CookieContainer();
req.GetRequestStream().Write(newbyte[0],0,0);
System.Net.HttpWebResponseres=(System.Net.HttpWebResponse)(req.GetResponse());
StreamReaderrs=newStreamReader(res.GetResponseStream(),System.Text.Encoding.GetEncoding("GB18030"));
strings=rs.ReadToEnd();
rs.Close();
req.Abort();
res.Close();
System.Text.RegularExpressions.Matchm=System.Text.RegularExpressions.Regex.Match(s,@"IP:\[(?<IP>[0-9\.]*)\]");
if(m.Success)returnm.Groups["IP"].Value;
returnstring.Empty;
}
{
Uriuri=newUri(" http://www.ikaka.com/ip/index.asp";);
System.Net.HttpWebRequestreq=(System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
req.Method="POST";
req.ContentType="application/x-www-form-urlencoded";
req.ContentLength=0;
req.CookieContainer=newSystem.Net.CookieContainer();
req.GetRequestStream().Write(newbyte[0],0,0);
System.Net.HttpWebResponseres=(System.Net.HttpWebResponse)(req.GetResponse());
StreamReaderrs=newStreamReader(res.GetResponseStream(),System.Text.Encoding.GetEncoding("GB18030"));
strings=rs.ReadToEnd();
rs.Close();
req.Abort();
res.Close();
System.Text.RegularExpressions.Matchm=System.Text.RegularExpressions.Regex.Match(s,@"IP:\[(?<IP>[0-9\.]*)\]");
if(m.Success)returnm.Groups["IP"].Value;
returnstring.Empty;
}