请教关于IdHTTP Post的问题

cubell 2005-08-20 09:40:36
这是我的代码,是BCB的
AnsiString UserName,Password, BaseURL;
AnsiString HTML;

BaseURL = "http://10.0.0.1/start.nsf/";
UserName = "guest";
Password = "guest";
TStringList* Params = new TStringList();
Params->Add("Username="+UserName);
Params->Add("Password="+Password);
Params->Add("comeurl="+BaseURL+"homepage?OpenFrameSet"); // 这里是登录成功后自动转入的页面,如果没有通过验证而访问此页面,将转入登录页面。 代码目标是需要取得此页面的内容

//IdHTTP1->Request->ContentType="application/x-www-form-urlencoded";
IdHTTP1->Post(BaseURL+"firstpage?openpage",Params); //这里是登录页面
Memo1->Text = HTML;
delete Params;

下面是登录页面的HTML源码,为何每次获得到结果都是它? 好像没有通过验证(确认登录密码没错)请高手看看问题出在哪,谢谢!
<HTML>
<!-- Lotus-Domino (Release 5.0.9 - November 16, 2001 on Solaris Sparc) -->
<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_openBrWindow(theURL,winName,features) { //v2.0
win0=window.open(theURL,winName,features);
win0.focus();
}
//MM_openBrWindow('/happy.htm','happy','width=480,height=350,left=width')
//MM_openBrWindow('/test.htm','test','width=500,height=250,left=0 ,top=0')
// -->
</SCRIPT>
</HEAD>
<BODY TEXT="000000" BGCOLOR="FFFFFF" bgcolor="#1D4994" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="/images/login/login_bg.jpg" onload=setTimeout("showlogin()",500)>

<FORM METHOD=post ACTION="/names.nsf?Login" NAME="_DominoForm">
<INPUT TYPE=hidden NAME="%%ModDate" VALUE="0000000000000000"><style type="text/css">
<!--
table { background-attachment: fixed; background-repeat: no-repeat; background-position: center center;}
body { background-repeat: no-repeat; background-position: center center;background-color: #1b4f9b}
-->
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td align="center" valign="middle"><br><br><br><br><br><br><br>
<table width="260" border="0" cellspacing="0" cellpadding="0" height="140" background="" style="filter: Alpha(Opacity=0)" id=maintable>
<tr>
<td align="center" valign="middle"><FONT SIZE=2 COLOR="ff0000"></FONT>
<table width="180" border="0" cellspacing="0" cellpadding="0" height="131" background="">
<tr>
<td width="180" align="center">
<table width="180" border="0" style=font-size:9pt cellspacing="4">
<tr>
<td width="60" style="color:#ffffff">用户名: </td>
<td width="100">
<INPUT NAME="Username" VALUE="" maxlength=256 size=10></td>
</tr>
<tr>
<td width="60" style="color:#ffffff">密码:</td>
<td width="100">
<INPUT NAME="Password" VALUE="" TYPE=password maxlength=256 size=10></td>
</tr>
<tr align="center">
<td colspan="2"> <br>
<input type="image" border="0" name="imageField" src="/images/login/confirm.gif" width=56 height=22>
</td>


</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p style=font-size:15pt> </p><p style=font-size:15pt> </p>
<div align="center"><font color="#2a7fcd">│</font><a href=# onclick="MM_openBrWindow('/link2.htm','','width=412,height=256')"><font color="#ffffff" style=font-size:9pt>技术支持</font></a><font color="#2a7fcd">│</font><a href=# onclick="MM_openBrWindow('/link3.htm','','width=412,height=256')"><font color="#ffffff" style=font-size:9pt>联系我们</font></a><font color="#2a7fcd">│</FONT>

</div>
<p> </p>
</font>
</td>
</tr>
</table>
<script language="JavaScript">
var loginAlpha=0;
function showlogin(){
if (loginAlpha<80) {
loginAlpha+=7;
maintable.style.filter="Alpha(Opacity="+loginAlpha+")";
alpha=setTimeout("showlogin()",50);
}
else {
setTimeout("focus()",50);
}
}
function focus(){
document.forms[0].Username.focus();
document.forms[0].Username.select();
}
</script>
<div style=display:none>
<P><FONT SIZE=2>
<INPUT NAME="RedirectTo" VALUE="/start.nsf/firstpage?openpage" type=hidden></FONT>
<P>
<INPUT TYPE=submit VALUE="提交"></FORM>
</BODY>
</HTML>
...全文
585 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
大志哥123 2006-03-17
  • 打赏
  • 举报
回复
燕南是你吗?
cqpostzhuxf 2006-03-17
  • 打赏
  • 举报
回复
我也碰到这样的问题,用抓包软件抓下来,才发展,BCB6里,使用IDHTTP时,用Get方法使用的是HTTP/1.1,而用POST方法却使用了HTTP/1.0
可能问题出在这里。不知哪位高手能解决一下这个问题。
cubell 2005-08-27
  • 打赏
  • 举报
回复
kinglh 2005-08-22
  • 打赏
  • 举报
回复
IdHTTP1->Post(BaseURL+"firstpage?openpage",Params); //这里是登录页面
这个Post不怎么好用,我以前也用过,也是出错,后来用Get()

那位高手来指点一下Post
cubell 2005-08-21
  • 打赏
  • 举报
回复
rainfall19831109 2005-08-21
  • 打赏
  • 举报
回复
我也正在郁闷这个问题....
我的情况简单多了...form里面仅仅是只有username和password...并且我已经把它post到action的路径下了...还是提示用户或密码错误...

你这里,我看问题也比较多...首先是,你post的内容有错误,各项应该用"&"符号隔开,我看你没隔开,另外,你post的内容不够,注意是要把form里面的都post上服务器,你只post了 "username","password"和 "comeurl"
最后,你post的地址是什么一回事??应该是post到action下面的地址啊....

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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