Everyone good, I believe that we have used proxy IP over the network, but some IP one or two days expired. To one of the manual to try to open ie, shut down IE, how annoying ah.
It would be nice to have this article. We can use Httpwebrequest,httpwebresponse to proxy verification, thank you for your comment guide!
Oh, is not very simple ah, in fact, this section of the code can also do a collector, thieves and other procedures! I'm not telling you, everybody, look.
public void Yanzhen (string str, int port)
{
WebProxy proxyobject = new WebProxy (str, port);//str for IP address port port number
HttpWebRequest Req = (HttpWebRequest) webrequest.create ("http://www.whatismyip.com.tw/");
Req.proxy = Proxyobject; Set up agents
Reprint please indicate from the problem solving Park http://wenti.cnblogs.com/
Article address
HttpWebResponse Resp = (HttpWebResponse) req.getresponse ();
String str = "";
String okstr = "";
Encoding code = encoding.getencoding ("UTF-8");
using (StreamReader sr = new StreamReader (Resp.getresponsestream (), code))
{
if (SR!= null)
{
Try
{
str = Sr. ReadToEnd ();
Stringsub.substr (str, "str = str. Substring (str. IndexOf (start) + start. Length);
Okstr = str. Substring (0, str. IndexOf (last));
MessageBox.Show ("Verify success!") Display IP as "+ okstr";
}
Catch
{
MessageBox.Show ("file read failed!") ");
}
Finally
{
Sr. Close ();
}
}
}
}
Oh, is not very simple ah, in fact, this section of the code can also do a collector, thieves and other procedures!