xmlhttp的有关cookie的一个问题!
xmlhttp的有关cookie的一个问题!
我用xmlhttp登录一个网页后,再向登录后的网页发送表单信息,返回说我未登录,估计是因为cookie的原因,可是用xmlhttp怎么解决这个问题呢
代码比如:
Dim logxml, idpw, postxml, info
idpw="id=abc&pw=pass"
Set logxml = Server.CreateObject("Microsoft.XMLHTTP")
logxml.Open "POST", "http://myserver/login", False
logxml.Send idpw
info="title=hello&content=world"
Set postxml = Server.CreateObject("Microsoft.XMLHTTP")
postxml.Open "POST", "http://myserver/post", False
postxml.Send
似乎两次POST是毫不相关的两次请求,因此认为后者是未登录的情况下要发表单信息,请高手指点如何解决!
问题点数:0、回复次数:5Top
1 楼saucer(思归)回复于 2003-09-04 01:10:55 得分 0
use xmlhttp's getResponseHeader and setRequestHeader method
Dim logxml, idpw, postxml, info, cookie
idpw="id=abc&pw=pass"
Set logxml = Server.CreateObject("Microsoft.XMLHTTP")
logxml.Open "POST", "http://myserver/login", False
logxml.Send idpw
cookie = logxml.getResponseHeader("Set-Cookie")
info="title=hello&content=world"
Set postxml = Server.CreateObject("Microsoft.XMLHTTP")
postxml.Open "POST", "http://myserver/post", False
postxml.setRequestHeader("Cookie",cookie)
postxml.Send
Top
2 楼anita2li(hehe...)回复于 2003-09-04 08:10:33 得分 0
UPTop
3 楼igotit(挽回不了)回复于 2003-09-04 16:30:12 得分 0
还是不行!
我刚知道有responseheader相关的三个函数,我刚才试了下
用.getResponseHeader("Set-Cookie")取得的值是空的
用.getAllResponseHeaders取得的值是
Connection: close Date: Thu, 04 Sep 2003 08:12:51 GMT Server: Apache/1.3.26 (Unix) PHP/4.2.0 mod_gzip/1.3.19.1a mod_fastcgi/2.2.10 Content-Type: text/html; charset=gb2312
里面没有cookie的信息
搞不懂服务器是如何判断我与它是否相连的呢?ip地址是不会变的啊!
Top
4 楼igotit(挽回不了)回复于 2003-09-04 23:10:01 得分 0
还有人可以帮助我吗?
Top
5 楼saucer(思归)回复于 2003-09-04 23:25:06 得分 0
do the login/post in the browser and carefully examine the html page coming back and see if there are any hidden input controls with session information
Top




