CHttpConnection和页面通讯,页面跳转,出现url重复的问题。

weiweiloong 2016-05-06 08:14:23
各位大侠,
我在做http登陆页面的功能,登陆成功后,页面跳转,
结果抓包发现,上次的页面登陆没有跳转
第一步:
登陆页面--》已经成功
CString strHost = _T("web.3324beet.com");
CString strUrl = _T("/Login?ReturnUrl=%2f");

CStringA strRequest = "UserName=daodao9&Password=aa123456&VerifyCode=";//提交的数据
strRequest += strVcode;
CString strHeader = _T("Content-Type: application/x-www-form-urlencoded\r\n");
pHttpConnection = m_SessionXiazhu.GetHttpConnection(strHost, m_Port);
if (pHttpConnection == NULL)
printf("CHttpConnection failed!");
m_pFile = pHttpConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, strUrl);
if (m_pFile == NULL)
printf("CHttpFile is NULL!");
m_pFile->AddRequestHeaders(strHeader);
m_pFile->SendRequest(strHeader, (LPVOID)(LPCSTR)strRequest, strRequest.GetLength());
登陆返回值正确,第二步获取信息返回值不正确,抓包后发现URL错误,可是我的输入确实下面的情况:
为什么会出现,第二次链接请求,带上了上次的url,出现了这样的情况
url === /Login?ReturnUrl=/Heji/NextIssueNo

正确的应该是:/Heji/NextIssueNo才对;
第二步:
获取信息页面:
CString strHost = _T("web.3324beet.com");
CString strUrl = _T("/Heji/NextIssueNo");

CString strRequest = strTime;//提交的数据
CString strHeader = _T("Content-Type: application/x-www-form-urlencoded\r\n");
try
{
pHttpConnection = m_SessionXiazhu.GetHttpConnection(strHost, IntPort);
if (pHttpConnection == NULL)
printf("CHttpConnection failed!");

m_pFile = pHttpConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET, strUrl);
if (m_pFile == NULL)
printf("CHttpFile is NULL!");
m_pFile->AddRequestHeaders(strHeader);
m_pFile->SendRequest(strHeader, 0,0);
...全文
1824 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
cchvsgame 2016-05-28
  • 打赏
  • 举报
回复
应该有缓存存在

7,656

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧