当前位置: 代码迷 >> ASP >> 窃贼程序在服务器无法登录采集
  详细解决方案

窃贼程序在服务器无法登录采集

热度:483   发布时间:2014-01-17 00:06:00.0
小偷程序在服务器无法登录采集
本帖最后由 kapinliu 于 2014-01-04 00:01:37 编辑
本人在本地xp professional系统中做了一个登录采集程序,可以顺利登录采集,但是放到windows server 2008 r2系统的服务器中却只能采集不用登录的,不能登录采集(每次自动跳转到登录页面),请问各位大侠是什么原因,是不是服务器需要什么设置?具体方法如下:
1、post登录方法
Function PostHttpPage(RefererUrl,PostUrl,PostData) 
    Dim xmlHttp 
    Dim RetStr      
    Set xmlHttp = CreateObject("Msxml2.XMLHTTP")  
    xmlHttp.Open "POST", PostUrl, False
    XmlHTTP.setRequestHeader "Content-Length",Len(PostData) 
    xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xmlHttp.setRequestHeader "Referer", RefererUrl
    xmlHttp.Send PostData 
    If Err.Number <> 0 Then 
        Set xmlHttp=Nothing
        PostHttpPage = "$False$"
        Exit Function
    End If
    PostHttpPage=bytesToBSTR(xmlHttp.responseBody,"GB2312")
    Set xmlHttp = nothing
End Function 
2、抓取信息方法
Function GetHttpPage(HttpUrl)
   If IsNull(HttpUrl)=True Or Len(HttpUrl)<18 Or HttpUrl="$False$" Then
      GetHttpPage="$False$"
      Exit Function
   End If
   Dim Http
   Set Http=server.createobject("MSXML2.XMLHTTP")
   Http.open "GET",HttpUrl,False
   Http.Send()
   If Http.Readystate<>4 then
      Set Http=Nothing 
      GetHttpPage="$False$"
      Exit function
   End if
   GetHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
   Set Http=Nothing
   If Err.number<>0 then
      Err.Clear
   End If
End Function

------解决办法--------------------
服务器的相关组件支持吗   
------解决办法--------------------
开了多worker processor吧。如果session不能共享的话,就不能登录。试试开单个看看。或者把服务里的asp什么什么state打开看看。
------解决办法--------------------
注意啊,服务器使用cookie来保持会话的,建议你用msxml2.serverxmlhttp这个类
------解决办法--------------------
登陆后有一个cookie记录asp的session id,没见你设置cookie的代码?xp也采集不了要登陆的页面吧
------解决办法--------------------
引用:
上述代码在本地xp pro+iis5中是可以登录采集的,但放在windows server 2008 r2 standard+iis6服务器中无法登录采集,但不用登录的网页是可以get和post采集的,说明session无法保存或丢失了,不知道各位有没有遇到过类似情况,总觉得似乎是服务器设置问题,但是尝试了好多方法都不管用


不可能吧,你都没有添加session的cookie怎么可能采集通过需要验证的页面
------解决办法--------------------
引用:
本人在本地xp professional系统中做了一个登录采集程序,可以顺利登录采集,但是放到windows server 2008 r2系统的服务器中却只能采集不用登录的,不能登录采集(每次自动跳转到登录页面),请问各位大侠是什么原因,是不是服务器需要什么设置?具体方法如下:
1、post登录方法
Function PostHttpPage(RefererUrl,PostUrl,PostData) 
    Dim xmlHttp 
    Dim RetStr      
    Set xmlHttp = CreateObject("Msxml2.XMLHTTP")  
    xmlHttp.Open "POST", PostUrl, False
    XmlHTTP.setRequestHeader "Content-Length",Len(PostData) 
    xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xmlHttp.setRequestHeader "Referer", RefererUrl
    xmlHttp.Send PostData 
    If Err.Number <> 0 Then 
        Set xmlHttp=Nothing
        PostHttpPage = "$False$"
        Exit Function
    End If
    PostHttpPage=bytesToBSTR(xmlHttp.responseBody,"GB2312")
    Set xmlHttp = nothing
End Function 
2、抓取信息方法
Function GetHttpPage(HttpUrl)
   If IsNull(HttpUrl)=True Or Len(HttpUrl)<18 Or HttpUrl="$False$" Then
  相关解决方案