问题描述
目的,从http://sys.59.cn/system/login.asp登录并获取指定页面的内容或其他操作,例如在http://sys.59.cn/System/askAdd.asp页面提交工单用户名bbbbbb密码111111遇到的问题是无法获取Cookie,好像经过了302跳转而且域名也发生了变化登录页面是http://sys.59.cn但似乎有跳转到www.59.cn然后又跳转到http://sys.59.cn,希望给出完整的代码先谢过了,祝大家国庆快乐!抓包数据如下:POST/System/Login_CK.aspHTTP/1.1Accept:image/gif,image/jpeg,image/pjpeg,image/pjpeg,application/x-shockwave-flash,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/msword,application/xaml+xml,application/x-ms-xbap,application/x-ms-application,application/vnd.ms-xpsdocument,*/*Referer:http://sys.59.cn/System/Login.aspAccept-Language:zh-cnUser-Agent:Mozilla/4.0(compatible;MSIE8.0;WindowsNT5.1;Trident/4.0;.NETCLR2.0.50727;.NET4.0C;.NET4.0E;.NETCLR3.0.4506.2152;.NETCLR3.5.30729)Content-Type:application/x-www-form-urlencodedAccept-Encoding:gzip,deflateHost:sys.59.cnContent-Length:56Connection:Keep-AliveCache-Control:no-cacheCookie:CNZZDATA1054906=cnzz_eid%3D1853262319-1411644488-http%253A%252F%252Fwww.59.cn%252F%26ntime%3D1412071416;ASPSESSIONIDQQRARDRA=HIICHFIAGEEOPOAEJONNNDDJbackUrl=&UserName=bbbbbb&PassWord=111111&sys=1&x=77&y=13HTTP/1.1200OKCache-Control:privateContent-Length:378Content-Type:text/html;Charset=gb2312Set-Cookie:Login=Leavings=0&ParentID=root&AgentOK=False&LoginKey=680478&City=%D6%A3%D6%DD&Email=bbbbbb%40qq%2Ecom&AgentLevel=0&UserName=bbbbbb&Status=0&UserID=bbbbbb&Login=yes&LoginName=f36a9a757a0c383d7347d43ad1d34672&uid=88099;path=/Server:IISX-Powered-By:WAF/2.0Date:Tue,30Sep201410:22:23GMTGET/hm.gif?cc=1&ck=1&cl=32-bit&ds=1680x1050&ep=12859%2C11375&et=3&fl=11.2&ja=1&ln=zh-cn&lo=0<=1412071426&nv=0&rnd=2084908526&si=8696e383381e50e2d7f1005b9cb1390d&st=4&v=1.0.64&lv=3HTTP/1.1Accept:*/*Referer:http://sys.59.cn/System/Login.aspAccept-Language:zh-cnUser-Agent:Mozilla/4.0(compatible;MSIE8.0;WindowsNT5.1;Trident/4.0;.NETCLR2.0.50727;.NET4.0C;.NET4.0E;.NETCLR3.0.4506.2152;.NETCLR3.5.30729)Accept-Encoding:gzip,deflateHost:hm.baidu.comConnection:Keep-AliveCookie:BAIDUID=D1C29CCE641409B7DC829F9EFF18207B:FG=1;HMACCOUNT=C3AB188BBBAFFD6BHTTP/1.1200OKCache-Control:private,max-age=0,no-cachePragma:no-cacheContent-Type:image/gifX-Content-Type-Options:nosniffConnection:Keep-AliveContent-Length:43Date:Tue,30Sep201410:23:14GMTServer:apachePOST/member/xml-login.aspHTTP/1.1Accept:image/gif,image/jpeg,image/pjpeg,image/pjpeg,application/x-shockwave-flash,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/msword,application/xaml+xml,application/x-ms-xbap,application/x-ms-application,application/vnd.ms-xpsdocument,*/*Referer:http://sys.59.cn/System/Login_CK.aspAccept-Language:zh-cnUser-Agent:Mozilla/4.0(compatible;MSIE8.0;WindowsNT5.1;Trident/4.0;.NETCLR2.0.50727;.NET4.0C;.NET4.0E;.NETCLR3.0.4506.2152;.NETCLR3.5.30729)Content-Type:application/x-www-form-urlencodedAccept-Encoding:gzip,deflateHost:www.59.cnContent-Length:98Connection:Keep-AliveCache-Control:no-cacheCookie:CNZZDATA1054906=cnzz_eid%3D555751742-1411644488-%26ntime%3D1411827112;CNZZDATA1000300574=1553121929-1411644489-%7C1411827113act=login&UserName=bbbbbb&PassWord=96e79218965eb72c92a549dd5a330112&backUrl=http%3A%2F%2Fsys.59.cnHTTP/1.1302ObjectmovedCache-Control:privateContent-Length:145Content-Type:text/html;Charset=gb2312Location:http://sys.59.cn/System/Set-Cookie:Login=Leavings=0&ParentID=root&AgentOK=False&LoginKey=751035&City=%D6%A3%D6%DD&Email=bbbbbb%40qq%2Ecom&AgentLevel=0&UserName=bbbbbb&Status=0&UserID=bbbbbb&Login=yes&uid=88099;path=/Set-Cookie:ASPSESSIONIDASQCQBSC=JAPJLCPAAFNLBLABJDOEBBLF;path=/Server:IISX-Powered-By:WAF/2.0Date:Tue,30Sep201410:22:24GMTGET/System/HTTP/1.1Accept:image/gif,image/jpeg,image/pjpeg,image/pjpeg,application/x-shockwave-flash,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/msword,application/xaml+xml,application/x-ms-xbap,application/x-ms-application,application/vnd.ms-xpsdocument,*/*Referer:http://sys.59.cn/System/Login_CK.aspAccept-Language:zh-cnUser-Agent:Mozilla/4.0(compatible;MSIE8.0;WindowsNT5.1;Trident/4.0;.NETCLR2.0.50727;.NET4.0C;.NET4.0E;.NETCLR3.0.4506.2152;.NETCLR3.5.30729)Cookie:CNZZDATA1054906=cnzz_eid%3D1853262319-1411644488-http%253A%252F%252Fwww.59.cn%252F%26ntime%3D1412071416;ASPSESSIONIDQQRARDRA=HIICHFIAGEEOPOAEJONNNDDJ;Login=Leavings=0&ParentID=root&AgentOK=False&LoginKey=680478&City=%D6%A3%D6%DD&Email=bbbbbb%40qq%2Ecom&AgentLevel=0&UserName=bbbbbb&Status=0&UserID=bbbbbb&Login=yes&LoginName=f36a9a757a0c383d7347d43ad1d34672&uid=88099Accept-Encoding:gzip,deflateConnection:Keep-AliveCache-Control:no-cacheHost:sys.59.cnHTTP/1.1302ObjectmovedCache-Control:privateContent-Length:129Content-Type:text/htmlLocation:Main.aspServer:IISX-Powered-By:WAF/2.0Date:Tue,30Sep201410:22:24GMTGET/System/Main.aspHTTP/1.1Accept:image/gif,image/jpeg,image/pjpeg,image/pjpeg,application/x-shockwave-flash,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/msword,application/xaml+xml,application/x-ms-xbap,application/x-ms-application,application/vnd.ms-xpsdocument,*/*Referer:http://sys.59.cn/System/Login_CK.aspAccept-Language:zh-cnUser-Agent:Mozilla/4.0(compatible;MSIE8.0;WindowsNT5.1;Trident/4.0;.NETCLR2.0.50727;.NET4.0C;.NET4.0E;.NETCLR3.0.4506.2152;.NETCLR3.5.30729)Cookie:CNZZDATA1054906=cnzz_eid%3D1853262319-1411644488-http%253A%252F%252Fwww.59.cn%252F%26ntime%3D1412071416;ASPSESSIONIDQQRARDRA=HIICHFIAGEEOPOAEJONNNDDJ;Login=Leavings=0&ParentID=root&AgentOK=False&LoginKey=680478&City=%D6%A3%D6%DD&Email=bbbbbb%40qq%2Ecom&AgentLevel=0&UserName=bbbbbb&Status=0&UserID=bbbbbb&Login=yes&LoginName=f36a9a757a0c383d7347d43ad1d34672&uid=88099Accept-Encoding:gzip,deflateConnection:Keep-AliveCache-Control:no-cacheHost:sys.59.cnHTTP/1.1200OKCache-Control:privateContent-Length:43961Content-Type:text/html;Charset=gb2312Server:IISX-Powered-By:WAF/2.0Date:Tue,30Sep201410:22:24GMT
解决方案
本帖最后由 sctongyi 于 2014-09-30 21:20:46 编辑
解决方案二:
PostBody="backUrl=&UserName=bbbbbb&PassWord=111111&x=48&y=8&sys=0"url="http://sys.59.cn/system/Login_CK.asp"DimobjXMLHTTPSetobjXMLHTTP=Server.CreateObject("WinHttp.WinHttpRequest.5.1")objXMLHTTP.Option(6)=1'objXMLHTTP.setTimeoutsFreeHost_t1,FreeHost_t2,FreeHost_t3,FreeHost_t4objXMLHTTP.open"POST",url,FalseobjXMLHTTP.setRequestHeader"Content-Type","application/x-www-form-urlencoded"objXMLHTTP.setRequestHeader"Content-Length",Len(PostBody)objXMLHTTP.setRequestHeader"Referer","http://sys.59.cn/system/login.asp"objXMLHTTP.sendPostBody'response.WriteobjXMLHTTP.getResponseHeader("Set-Cookie")'aaa=objXMLHTTP.getResponseHeader("Set-Cookie")POSTOP=objXMLHTTP.responseTextSetobjXMLHTTP=Nothingresponse.WritePOSTOP
解决方案三:
类似上面的完整代码,等待高人出现