想做一个结合动网论坛的程序,获取帖子,可以编辑,发帖等等。类似有人做过的一个"CSDN论坛助手"的那类似的程序。获取容易,new一个cookieContainer,加入cookieContainer.Add(bbsRoot,new Cookie("iscookies", "0"));把此cookie赋予httpwebrequest就能顺利获得帖子。然而发帖,编辑等需要验证用户身份的操作就郁闷了。我使用ieHttpHeeader查看,第一次登陆(我机器保留有我的cookie),cookie信息如下:Cookie: iscookies=0; BoardList=BoardID=Show; aspsky=userid=1960&usercookies=3&userhidden=2&password=b95d2df18c9654bc&userclass=%B1%BE%BF%C6&username=shrinerain其中shrinerain是我在这个论坛的用户名。服务器返回200以后,第二次提交的信息如下:Cookie: iscookies=0; BoardList=BoardID=Show; aspsky=userid=1960&usercookies=3&userhidden=2&password=b95d2df18c9654bc&userclass=%B1%BE%BF%C6&username=shrinerain; ASPSESSIONIDQSTSBDQC=HIMCLJOCGMMAOPIKKMGDEPAH多了一个ASPSESSIONID...我尝试设置在程序里设置cookie为cookieContainer.Add(bbsRoot,new Cookie("iscookies", "0"));
cookieContainer.Add(bbsRoot,new Cookie("userid","1960"));
cookieContainer.Add(bbsRoot,new Cookie("usercookies","3"));
cookieContainer.Add(bbsRoot,new Cookie("userhidden","2"));
cookieContainer.Add(bbsRoot,new Cookie("password","b95d2df18c9654bc"));
cookieContainer.Add(bbsRoot,new Cookie("userclass","%B1%BE%BF%C6"));
cookieContainer.Add(bbsRoot,new Cookie("username","shrinerain"));
cookieContainer.Add(bbsRoot,new Cookie("ASPSESSIONIDQSSTBCRD","LEBMINBCCFFEDBOIGAKLGMMK"));可是不起作用,获取的仍然是没有通过身份验证的状态,请各位牛人指教,谢谢!