http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 4823|回复: 2

[求助] request内容基本与浏览器一样,但respone不一样,苦恼

[复制链接]
发表于 2013-10-13 17:08:55 | 显示全部楼层 |阅读模式
本帖最后由 Michael_/tp 于 2013-10-13 17:12 编辑

目前有个项目,做模拟登陆提交,在登陆和访问都OK了,但有一个页面post过去总是会RedirectUrl去另一个提示页面,而正常浏览器访问却是OK的。
前面的登陆认证访问都OK的,查资料也OK,
就是提交这个页面时,header和postdata基本都和ie一样了(除了header顺序有几个不一样),但返回的结果ie是200正常,而我的程序却是302跳转提示页。还有什么未考虑到的地方呢??
搞了一个星期都没理出个头绪,望各位大神提点一下。

(不方便提供实际网址)下面提交两组RAM STREAM:
浏览器访问send
  1. POST /xxxxxx.aspx  HTTP/1.1
  2. Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/QVOD, application/QVOD, */*
  3. Referer: http://xxxxxx.aspx
  4. Accept-Language: zh-CN
  5. User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; Tablet PC 2.0; .NET4.0C; .NET4.0E)
  6. Content-Type: application/x-www-form-urlencoded
  7. Accept-Encoding: gzip, deflate
  8. Host: 123.cn
  9. Content-Length: 514
  10. Connection: Keep-Alive
  11. Cache-Control: no-cache
  12. Cookie: CNZZDATA946534=cnzz_eid%3D982449492-1364719605-%26ntime%3D1381200938%26cnzz_a%3D0%26retime%3D1381200936858%26sin%3D%26ltime%3D1381200936858%26rtime%3D29; ASP.NET_SessionId=2lhg4sfdkxsl1f45fzneymfi

  13. __VIEWSTATE=%2FwEPDwUJNzYxOTMwNDM5DxYCHgZnZXRCb29nFgICAw9kFgoCAQ8PFgIeBFRleHQFCjIwMTMtMTAtMThkZAIDDw8WAh8BBRUyMOeCueWcuigyMDowMC0yMTowMClkZAIFDxYCHglpbm5lcmh0bWwFATFkAgcPFgIfAgUDMS8wZAIJDw8WBB8BBQ0yMTIxMTI5MzI2NjQwHgdFbmFibGVkaGRkZIr53w%2BDxYTxSgcpJUun1biwgMpD&__EVENTVALIDATION=%2FwEWCAL9xvXyAgKZ%2B%2FryDgKB5YSbDgKM54rGBgK7q7GGCAK%2B9bPHDwKBlc%2ByCAKom6beDWgo%2BubmfA2ePlpY7yBjemsAtpOM&txtVail=lcfj&Button1=%E7%A1%AE%E5%AE%9A%E9%A2%84%E7%BA%A6&HiddenFieldshift_id=161889&HiddenFieldshift_no=30644&hfdLshs=%270%27
复制代码
浏览器访问receive
  1. HTTP/1.1 200 OK
  2. Date: Sun, 13 Oct 2013 07:53:10 GMT
  3. Server: WAF
  4. X-AspNet-Version: 2.0.50727
  5. Cache-Control: private
  6. Content-Type: text/html; charset=utf-8
  7. Content-Length: 5458
  8. Keep-Alive: timeout=5, max=100
  9. Connection: Keep-Alive

  10. (下面正常HTML省略)
复制代码
程序模拟send
  1. POST /xxxxxx.aspx  HTTP/1.1
  2. Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/QVOD, application/QVOD, */*
  3. Referer: http://xxxxxx.aspx
  4. Accept-Language: zh-CN
  5. User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; Tablet PC 2.0; .NET4.0C; .NET4.0E; SE 2.X MetaSr 1.0)
  6. Content-Type: application/x-www-form-urlencoded
  7. Accept-Encoding: gzip,deflate
  8. Connection: Keep-Alive
  9. Cache-Control: no-cache
  10. Cookie: CNZZDATA946534=cnzz_eid%3D982449492-1364719605-%26ntime%3D1381200938%26cnzz_a%3D0%26retime%3D1381200936858%26sin%3D%26ltime%3D1381200936858%26rtime%3D29;ASP.NET_SessionId=zvetomf2et12d045p2oddh45
  11. Host: 123.cn
  12. Content-Length: 514

  13. __VIEWSTATE=%2FwEPDwUJNzYxOTMwNDM5DxYCHgZnZXRCb29nFgICAw9kFgoCAQ8PFgIeBFRleHQFCjIwMTMtMTAtMThkZAIDDw8WAh8BBRUyMOeCueWcuigyMDowMC0yMTowMClkZAIFDxYCHglpbm5lcmh0bWwFATFkAgcPFgIfAgUDMS8wZAIJDw8WBB8BBQ0yMTIxMTI5MzI2NjQwHgdFbmFibGVkaGRkZIr53w%2bDxYTxSgcpJUun1biwgMpD&__EVENTVALIDATION=%2FwEWCAL9xvXyAgKZ%2b%2FryDgKB5YSbDgKM54rGBgK7q7GGCAK%2b9bPHDwKBlc%2byCAKom6beDWgo%2bubmfA2ePlpY7yBjemsAtpOM&txtVail=IH42&Button1=%E7%A1%AE%E5%AE%9A%E9%A2%84%E7%BA%A6&HiddenFieldshift_id=161889&HiddenFieldshift_no=30644&hfdLshs=%270%27
复制代码
程序模拟receive
  1. (Status-Line)  HTTP/1.1 302 Found
  2. Date  Sun, 13 Oct 2013 07:54:48 GMT
  3. Server  WAF
  4. X-AspNet-Version  2.0.50727
  5. Location  /xxxx2.aspx
  6. Cache-Control  private
  7. Content-Type  text/html; charset=utf-8
  8. Content-Length  179
  9. Keep-Alive  timeout=5, max=100
  10. Connection  Keep-Alive
复制代码
xxxx2.aspx 页面是提示"系统繁忙,请稍后再试"
但我每次程序测都是这样跳转,每页浏览器操作都是正常的。
所以可以肯定这个提示只是幌子。


问题:
1.从我程序模拟考虑,还差什么呢?
2.从网站程序考虑,如果RAM STREAM一样的话,可以区别我是程序访问而不是浏览器正常访问吗?




1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2013-10-14 08:10:35 | 显示全部楼层
光贴这些不容易看出来,你贴下你请求的Http代码。
 楼主| 发表于 2013-10-14 16:01:44 | 显示全部楼层
站长苏飞 发表于 2013-10-14 08:10
光贴这些不容易看出来,你贴下你请求的Http代码。
  1.             myitem = new HttpItem();
  2.             myitem.URL = "http://xxxxxx.aspx"
  3.             myitem.Accept = "image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/QVOD, application/QVOD, */*";
  4.             myitem.Referer = myitem.URL;
  5.             myitem.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; Tablet PC 2.0; .NET4.0C; .NET4.0E)";
  6.             myitem.ContentType = "application/x-www-form-urlencoded";
  7.             myitem.Header["Accept-Encoding"] = "gzip, deflate";
  8.             myitem.Header["Accept-Language"] = "zh-CN";
  9.             myitem.KeepAlive = true;
  10.             myitem.Header["Cache-Control"] = "no-cache";
  11.             myitem.Postdata = g_str_3;
  12.             myitem.Method = "post";
  13.             myitem.Cookie = mycookie1;

  14.             //得到HTML代码
  15.             myresult = new HttpResult();
  16.             myresult = myhttp.GetHtml(myitem);
复制代码
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-11-23 11:49

© 2014-2021

快速回复 返回顶部 返回列表