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

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

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

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

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

查看: 24719|回复: 23

[HttpHelper] C#post提交到dwr框架返回数据错误

[复制链接]
发表于 2014-10-16 12:36:33 | 显示全部楼层 |阅读模式
5金钱
C#post提交到dwr页面返回数据错误,抓包的信息是通过httpwatch抓的,在软件中模拟,
返回的数据是
throw 'allowScriptTagRemoting is false.';
//#DWR-REPLY
if (window.dwr) dwr.engine._remoteHandleBatchException({ name:'java.lang.SecurityException', message:'Session Error' });
else if (window.parent.dwr) window.parent.dwr.engine._remoteHandleBatchException({ name:'java.lang.SecurityException', message:'Session Error' });
下面是抓包信息
POST /ilearn/dwr/call/plaincall/lessonStudyData.updateRcoTreeList.dwr HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Referer: https://learning.sinopec.com/ile ... t.jsp?rco_id=149431
Content-Type: text/plain
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727)
Host: learning.sinopec.com
Content-Length: 1492
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: JSESSIONID=7f00000130d54c5b57114ce3499fb71aa5013bcbf830.e34TaN8Qbh8Rc40LbxuRbN0OchuKe6fznA5Pp7ftolbGmkTy; PD-S-SESSION-ID=2_1_DIWZevre5xATMO2GQjDBHsK2Mg16b3UWhlassJVaV0IHbJGJ; PD-ID=VxKfT5YlbkR3UBs/YFeHpJ4vzwUmoK4brHvglw8GOGg1BeZpu+RQgnYyUqpZtDnmq2Wd+FJ4XQkty7s3XUZEQHA6x0kyJZ/whzmP4DVk67xiSy8CHhVeDe4Dn3OLh7Ppkyeua/i99FsBZUSWoPH6XKieIu5Be0WMUnkAut7G6W9oNoz9MPMRy4xD7xp6bUdXHzcvgbOQCTk092TuwB0lRstPL1T2EFubZ2lPr1ZBT9Wy9e4PYlno4O+g/ZuTmMw6NEo12EH3XMNZugfoWoFvVw==; PD_STATEFUL_7d34c2c6-d447-11e3-9010-00155d814c01=%2Filearn; oracle.ila.player=sWoAg5Snutw9tmJ3YX1CWuPSBPP68Pw4tUccSxovf6C6cP56kOToBU+5WXhZeVRd5Jj69T/oxP51%COkgGRRkY7Fp/g$$

callCount=1
page=/ilearn/en/learner/jsp/player/player_left.jsp?rco_id=149431
httpSessionId=7f00000130d54c5b57114ce3499fb71aa5013bcbf830.e34TaN8Qbh8Rc40LbxuRbN0OchuKe6fznA5Pp7ftolbGmkTy
scriptSessionId=BB05C30FAC0C643B7C86EDCC97909DB8636
c0-scriptName=lessonStudyData
c0-methodName=updateRcoTreeList
c0-id=0
c0-e1=string:149431
c0-e2=string:149432
c0-e3=string:149432
c0-e4=string:13582221
c0-e5=string:1225367
c0-e6=string:13611016
c0-e7=string:181
c0-e8=string:incomplete
c0-e9=string:0.0
c0-e10=string:
c0-e11=string:
c0-e12=string:
c0-e13=string:2014-10-16%2014%3A18%3A24
c0-e14=string:2014-10-16%2015%3A25%3A53
c0-e15=string:0.0
c0-e16=string:I
c0-e17=string:
c0-e18=string:
c0-e19=string:33
c0-e20=string:N
c0-e21=string:C
c0-e22=string:Y
c0-param0=Object_Object:{rco_id:reference:c0-e1, pre_rco_id:reference:c0-e2, curr_rco_id:reference:c0-e3, icr_id:reference:c0-e4, user_id:reference:c0-e5, tbc_id:reference:c0-e6, site_id:reference:c0-e7, cmi_core_lesson_status:reference:c0-e8, cmi_core_score_raw:reference:c0-e9, cmi_core_lesson_location:reference:c0-e10, cmi_suspend_data:reference:c0-e11, cmi_core_session_time:reference:c0-e12, start_time:reference:c0-e13, start_study_time:reference:c0-e14, pre_score:reference:c0-e15, pre_status:reference:c0-e16, pre_location:reference:c0-e17, pre_suspend_data:reference:c0-e18, effectivelength:reference:c0-e19, is_lesson_time:reference:c0-e20, tracking_type:reference:c0-e21, attempt_num_flag:reference:c0-e22}
c0-param1=string:U
batchId=5
下面是post代码:
    item = new HttpItem()
                       {
                           URL = "https://learning.sinopec.com/ilearn/dwr/call/plaincall/lessonStudyData.updateRcoTreeList.dwr",
                           Method = "POST",
                           Accept = "*/*",
                           Referer = "https://learning.sinopec.com/ilearn/en/learner/jsp/player/player_left.jsp?rco_id=149431",                           
                           ContentType = "text/plain",//返回类型   
                           Postdata = "callCount=1" +"&" + "page=/ilearn/en/learner/jsp/player/player_left.jsp?rco_id=149431" /
                 //数据太长,     两个相邻数据用“&”,或者用“\r\n” 换行符                  
                           Cookie = Cookies,
                       };
                    result = http.GetHtml(item);
                    Cookies = Utilities.MergerCookies(Cookies, result.Cookie);
                    retCode = result.Html;
用“&”,或者用“\r\n” 换行符  都试验过。。。。。POST的返回都是
throw 'allowScriptTagRemoting is false.';
//#DWR-REPLY
if (window.dwr) dwr.engine._remoteHandleBatchException({ name:'java.lang.SecurityException', message:'Session Error' });
else if (window.parent.dwr) window.parent.dwr.engine._remoteHandleBatchException({ name:'java.lang.SecurityException', message:'Session Error' });
疑问:1.Postdata 的格式是否正确,如不正确,应该怎么写。
          2.POST之前是不是还有别的需要执行的(如JS或者是窗口信息之类的)





最佳答案

查看完整内容

好粗心啊!! 上述结果正确吗? 如正确,按以下方法改动: 1.最后POST数据的连接用"\r\n",而非"&"。 2.string KCookies = Utilities.GetMidStr(result.Cookie, "JSESSIONID=", ";"); 而非string KCookies = result.Cookie; 另:你手里有我最新的“C#代码生成器”,你在我的好友里?


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2014-10-16 12:36:34 | 显示全部楼层
zhty2014 发表于 2014-10-17 09:27
。。。没有。还是那个错误
throw 'allowScriptTagRemoting is false.';
//#DWR-REPLY

结果.jpg
好粗心啊!!
上述结果正确吗?
如正确,按以下方法改动:
1.最后POST数据的连接用"\r\n",而非"&"。
2.string KCookies = Utilities.GetMidStr(result.Cookie, "JSESSIONID=", ";"); 而非string KCookies = result.Cookie;
另:你手里有我最新的“C#代码生成器”,你在我的好友里?
回复

使用道具 举报

发表于 2014-10-16 12:55:40 | 显示全部楼层
Post的数据没有写完整吧
回复

使用道具 举报

 楼主| 发表于 2014-10-16 13:04:16 | 显示全部楼层
站长苏飞 发表于 2014-10-16 12:55
Post的数据没有写完整吧

程序里是写完整的,这里看着乱我就没写那么多,中间用“&”或者“\r\n”连接的  两种方式都试过。。都出错
回复

使用道具 举报

 楼主| 发表于 2014-10-16 13:05:33 | 显示全部楼层
站长苏飞 发表于 2014-10-16 12:55
Post的数据没有写完整吧

     Postdata = "callCount=1" +"&" + "page=/ilearn/en/learner/jsp/player/player_left.jsp?rco_id=149431" +"&" + "httpSessionId=" + KCookies +"&" + "scriptSessionId=" + SessionId +"&" + "c0-scriptName=lessonStudyData" +"&" + "c0-methodName=updateRcoTreeList" +"&" + "c0-id=0" +"&" + "c0-e1=string:149431" +"&" + "c0-e2=string:149432" +"&" + "c0-e3=string:149432" +"&" + "c0-e4=string:13582221" +"&" + "c0-e5=string:" + userid +""+"&" + "c0-e6=string:13611016" +"&" + "c0-e7=string:181" +"&" + "c0-e8=string:complete" +"&" + "c0-e9=string:0.0" +"&" + "c0-e10=string:" +"&" + "c0-e11=string:" +"&" + "c0-e12=string:" +"&" + "c0-e13=string:2014-10-15%2017%3A44%3A20" +"&" + "c0-e14=string:2014-10-15%2017%3A59%3A20" +"&" + "c0-e15=string:0.0" +"&" + "c0-e16=string:I" +"&" + "c0-e17=string:" +"&" + "c0-e18=string:" +"&" + "c0-e19=string:30" +"&" + "c0-e20=string:N" +"&" + "c0-e21=string:C" +"&" + "c0-e22=string:Y" +"&" + "c0-param0=Object_Object:{rco_id:reference:c0-e1, pre_rco_id:reference:c0-e2, curr_rco_id:reference:c0-e3,icr_id:reference:c0-e4, user_id:reference:c0-e5, tbc_id:reference:c0-e6, site_id:reference:c0-e7,cmi_core_lesson_status:reference:c0-e8, cmi_core_score_raw:reference:c0-e9, cmi_core_lesson_location:reference:c0-e10, cmi_suspend_data:reference:c0-e11, cmi_core_session_time:reference:c0-e12, start_time:reference:c0-e13,start_study_time:reference:c0-e14, pre_score:reference:c0-e15, pre_status:reference:c0-e16,pre_location:reference:c0-e17, pre_suspend_data:reference:c0-e18, effectivelength:reference:c0-e19,is_lesson_time:reference:c0-e20, tracking_type:reference:c0-e21, attempt_num_flag:reference:c0-e22}" +"&" + "c0-param1=string:U" +"&" + "batchId=1",                              
                     
回复

使用道具 举报

发表于 2014-10-16 13:09:19 | 显示全部楼层
出的什么错
回复

使用道具 举报

 楼主| 发表于 2014-10-16 13:14:28 | 显示全部楼层



throw 'allowScriptTagRemoting is false.';
//#DWR-REPLY
if (window.dwr) dwr.engine._remoteHandleBatchException({ name:'java.lang.SecurityException', message:'Session Error' });
else if (window.parent.dwr) window.parent.dwr.engine._remoteHandleBatchException({ name:'java.lang.SecurityException', message:'Session Error' });
回复

使用道具 举报

 楼主| 发表于 2014-10-16 13:15:07 | 显示全部楼层

大神再帮我看看吧
回复

使用道具 举报

发表于 2014-10-16 13:29:09 | 显示全部楼层
看样子像是Cookie没有验证通过,你把Cookie中的Path等多余参考全部删除试试
回复

使用道具 举报

 楼主| 发表于 2014-10-16 13:33:46 | 显示全部楼层
站长苏飞 发表于 2014-10-16 13:29
看样子像是Cookie没有验证通过,你把Cookie中的Path等多余参考全部删除试试

好的,我先试试
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

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

GMT+8, 2024-11-24 16:41

© 2014-2021

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