|
楼主 |
发表于 2015-3-20 15:34:37
|
显示全部楼层
本帖最后由 2949497060 于 2015-3-20 15:38 编辑
代码如下:
for (int i = 0; i < 30; i++)
{
Application.DoEvents();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://auction1.paipai.com/8F3F1A58000000000401000043BE2D4C");
request.AllowAutoRedirect = true;
request.Timeout = 40;
request.ReadWriteTimeout = 40;
HttpWebResponse response = null;
DateTime dt1 = DateTime.Now;
try
{
response = (HttpWebResponse)request.GetResponse();
txtSrcCode.AppendText(string.Format("{0}\r\n", (DateTime.Now - dt1).TotalMilliseconds));
}
catch
{
txtSrcCode.AppendText(string.Format("Err:{0}\r\n", (DateTime.Now - dt1).TotalMilliseconds));
}
finally
{
if (response != null)
{
response.Close();
}
request.Abort();
}
}
|
|