使用 HttpWebRequest 访问一个网站然后更换IP,再访问该网站,一定要等到超时返回错误,然后重新访问,就能立刻获得数据.有没有朋友知道怎么回事?

解决方案 »

  1.   

    你跟踪看下两次访问网站cookie是不是不一样了
      

  2.   

    访问时都清空了COOKIE,是不需要COOKIE即可访问的页面.
    更换IP以后,包括 HttpWebRequest 都是重新声明的.
      

  3.   

    可能request内部的TCP连接没有关闭导致的
    设置request.KeepAlive=false;
    try
    {
        response = request.GetResponse();
    }
    finally
    {
        if(response != null) response.close();
    }
      

  4.   

                finally
                {
                    if (request != null)
                    {
                        request.Abort();
                    }
                      if (response != null)
                    {
                        response.Close();
                        response = null;
                    }
                }也做了
      

  5.   

    request.KeepAlive=true;只有这里设置为true的
      

  6.   

    另启一个httpwebrequest访问,前面这个估计有信息没有清除
      

  7.   


    ADSL,但走路由器链接. POST路由器,拨号换IP.