CWebBrowser2空间与asp页面通讯,数据发送成功,验证出错,谢谢!

flashmagic 2006-03-14 12:16:47
/********************vc代码**********************/

char *p="u_name=110105";
......
......
m_brows.Navigate("http://www.projectg.cn/login.asp",&te2,&te2,&te1,&te2);

程序没有问题,截获的数据包如下:
/***************************ip数据包*****************************/
POST /login.asp HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)
Host: www.projectg.cn
Content-Length: 14
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: rtime=6; ltime=1142259300187; cnzz_eid=4522911-; cnzz02=13

u_name=110105
/****************************************************************/


login.asp页面如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Dim u_name
u_name = Request.QueryString("u_name")
if u_name="" then
Response.Redirect("Erro.asp")
response.end
end if
%>


/*************************问题**************************/
我这个login.asp页面使用Request.QueryString接受参数的,直接在ie地址栏测试没有问题。


我的程序编译成功,也把数据把发出去了,但是通过这个程序在服务器那边调用login.asp页面的时候返回给这个程序的ip数据包总是错的。也就是说,在login.asp这个页面中“if u_name="" then”这条语句没有通过,总是调用的“Response.Redirect("Erro.asp")”这条语句。所以,服务器发回给我的数据包如下:
/********************从服务器返回数据包************************/
HTTP/1.1 200 OK
Date: Mon, 13 Mar 2006 15:58:26 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Length: 334
Content-Type: text/html
Cache-control: private

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Erro</title>
</head>

<body>
<p align="center">´íÎó</p>
</body>
</html>
/***********************************************/




这是一个感性的认识,但我还发现了一个奇怪的问题,就是我的程序似乎想服务器发送了4个数据包。
其中还有一个是:
/**********************所发送的最后一个包************************/
GET /test/Erro.asp HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)
Host: www.projectg.cn
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: rtime=6; ltime=1142259300187; cnzz_eid=4522911-; cnzz02=13; ASPSESSIONIDASQCSDBT=GFDLMCDCCOMMMNEDIHENKHAA
/**********************************************/


当然,服务器首先给我返回的是这个数据包:
HTTP/1.1 302 Object moved
Date: Mon, 13 Mar 2006 15:58:26 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Location: Erro.asp
Content-Length: 129
Content-Type: text/html
Set-Cookie: ASPSESSIONIDASQCSDBT=GFDLMCDCCOMMMNEDIHENKHAA; path=/
Cache-control: private

<head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a HREF="Erro.asp">here</a>.</body>
M




我现在不知道是那里的问题,但拿出来,似乎都没有问题,放在一起就。。。。。还请指点一下,谢谢了!
...全文
66 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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