各位前辈们,你们好.我的问题是这样的.

解决方案 »

  1.   

    我用Firefox的开发工具 获取到了一个网站登录后的cookie,
    随后我写了一个方法,携带着登录后的cookie,获取页面源代码,但是仍然不是登录后的页面源代码
    不知道为什么,想请教前辈们, 随后是一些相关信息.一,获取的方法是这样的 
    //进行登陆后的操作
      GetMethod getMethod = new GetMethod(dataUrl);
    //每次访问需授权的网址时需带上前面的 cookie 作为通行证
      getMethod.setRequestHeader("cookie",tmpcookies);
      httpClient.executeMethod(getMethod);
      String text = getMethod.getResponseBodyAsString();
      System.out.println(text);二,网站是 bbs.21ic.com
    三,通过firefox获取到的cookie如下:
    1.登录url 也就是post的url:
    http://passport2.21ic.com/logging.php?action=login&index=1&loginsubmit=yes
    2.Connection Keep-Alive
      Content-Encoding gzip
      Content-Length 2559
      Content-Type         text/html; charset=UTF-8
      Date                 Tue, 30 Oct 2012 03:42:02 GMT
      Keep-Alive         timeout=15, max=100
      Server         Apache
      Set-Cookie            aSr_cookietime=deleted; expires=Mon, 31-Oct-2011 03:42:01 GMT; path=/; domain=.21ic.com www_username=fangbaobin; path=/; domain=.21ic.com aSr_auth=ad7cFmczlqGK2spLHBD7cMT94g0nk8QxZ%2B6XZIqid18e1Mh9wSHG8xcf3mxlwWpg2OWP2SgEZl5H2ksRrtNZIJKwsWN7; path=/; HttpOnly; domain=.21ic.com aSr_loginuser=deleted; expires=Mon, 31-Oct-2011 03:42:01 GMT; path=/; domain=.21ic.com aSr_activationauth=deleted; expires=Mon, 31-Oct-2011 03:42:01 GMT; path=/; domain=.21ic.com aSr_pmnum=deleted; expires=Mon, 31-Oct-2011 03:42:01 GMT; path=/; domain=.21ic.com  Vary                  Accept-Encoding
    我直接将Set-Cookie的参数 声明一个字符串(tmpcookies),用上面的获取方法获取,为什么会得不到登录后的源代码呢???