HttpClient突破验证码提交数据问题
验证码识别已经搞定       
       但是登陆的时候仍然说验证码错误                  
       PostMethod         authpost         =         new         PostMethod( "/login ");                  
       NameValuePair         user         =         new         NameValuePair( "user ", "user ");       
       NameValuePair         psw         =         new         NameValuePair( "pass ", "psw ");                  
       String         strConfirm         =         ImageOrc.getText( "http://localhost/confirm ");       
       NameValuePair         cfm         =         new         NameValuePair( "confirm ",strConfirm ");                  
       authpost.setRequestBody(new         NameValuePair[]         {user,psw,cfm});       
       client.executeMethod(authpost);                    
 getText方法:   
 public   String   getText(String   url) 
 { 
 BufferedImage   imd; 
 StringBuffer   sb   =   new   StringBuffer( " "); 
 try   { 
 imd   =   ImageIO.read(new   URL(url));//   用ImageIO的静态方法读取图像 
 ImageIO.write(imd,    "BMP ",   new   File(file));   
 }   catch   (Exception   ex)   { 
 ex.printStackTrace();   
 }   
 String   sk=Icp.creak(file); 
 return   sk; 
 }     
       每次返回都说验证码不成功。       
       验证码是存在session里面的,       
       图片识别也是100%                  
       这里可能是什么问题?       
       请大家指点一下              
 网上看了很多资料说 
       String         strConfirm         =         ImageOrc.getText( "http://localhost/confirm ");    
 这句代码的session和你登陆的session不是同一个。       
       要用同一个client去取。才能保证在一个session里面   
 但是这个URL是用new   URL(url)来生成图片的。如何获得此Session? 
 我测试过。整个过程的sessionID都是一致的。。不知道问题出在哪儿。请高手指点
------解决方案--------------------注意几点:   
 1.你的Client每获取一次图片的url,验证码就重新生成一次。 
 2.验证码只对应你当前的session,如果你另起一个连接去取,那么另一个连接是另外一个session ID,不是你当前登陆页面的这个。
------解决方案--------------------你应该获取当前页面的session。然后使用该session去访问图片URL(使用jsessionid参数)。这样获得的图片验证码就和你当前页面一致了。
------解决方案--------------------还有个问题。也希望兄弟解答下。刚遇到的。很急。。。。     
 用HttpClient实验新浪登陆  
    返回结果是登陆成功。但是进入一个后台管理页。就又回到了登陆页了。以下是源码   
 //1。登陆 
 PostMethod post = new PostMethod( "http://blog.sina.com.cn/login.php?url=http://blog.sina.com.cn/control/ "); 
 NameValuePair[] data = { 
 new NameValuePair( "loginname ", username), 
 new NameValuePair( "passwd ", password)}; 
 post.setRequestBody(data); 
 int codeState = http.executeMethod(post); 
 post.releaseConnection();   
 //2。登陆成功以后 我想马上跳到后台管理页   
 String titileSendView= "http://blog.sina.com.cn/control/ ";   
 GetMethod  getMethod = new GetMethod(titileSendView);